0
我在ASP.NET MVC4 Web應用程序中定義了一個Exercise實體。 我使用默認的AccountModels.cs類的表單身份驗證。在ASP.NET MVC4中保存用戶和實體之間的關係
我有課,它看起來像
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?