ASP.NET MVC4 Web アプリケーションで定義された演習エンティティがあります。デフォルトの AccountModels.cs クラスでフォーム認証を使用しています。
私は次のようなクラスを持っています
public class Exercise
{
private DateTime _DateCreated = DateTime.Now;
private UserProfile _Teacher;
public int Id{ get; set; }
public string Question { get; set; }
public int Anwser { get; set; }
public string Category { get; set; }
public int maxNbrOfAttempts { get; set; }
public string Hints { get; set; }
public virtual ICollection<Quiz> Quizzes { get; set; }
public DateTime Date
{
get { return _DateCreated; }
set { _DateCreated = value; }
}
public UserProfile Author
{
get { return _Teacher; }
set { _Teacher = value; }
}
}
UserProfile を正しく使用して、エクササイズとログイン ユーザーをリンクしていますか? コントローラーで現在の UserProfile を取得するにはどうすればよいですか?