시스템의 모든 사용자 목록을 생성하려고합니다. 기본 내장 인증을 사용하고 있습니다. 난 내 컨트롤러에서 올바른, 데이타베이스 컨텍스트를 사용하고 있습니까 : 지금은이내 asp mvc보기에서 사용할 모델
public class ApplicationUser : IdentityUser
{
[Required]
[MaxLength(50)]
public string email { get; set; }
[Required]
[StringLength(11, MinimumLength = 11)]
public string cellNo { get; set; }
[Required]
[MaxLength(50), MinLengthAttribute(3)]
public string firstName { get; set; }
[Required]
[MaxLength(50), MinLengthAttribute(3)]
public string lastName { get; set; }
public DateTime birthdate { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("AuthenticationConnection")
{
}
}
라는 사용자가 컨트롤러를 만듭니다 :
public class UsersController : Controller
{
private User_Manager_Interface.Models.ApplicationDbContext userDb = new User_Manager_Interface.Models.ApplicationDbContext();
// GET: /Users/
public ActionResult Index()
{
return View(userDb.Users.ToList());
}
}
1 여기
내 정체성 모델 클래스입니다?2 : 내보기에는 어떤 모델을 사용해야합니까? 나는 그것을 실행할 때 이 @model IEnumerable<User_Manager_Interface.Models.ApplicationDbContext>
그러나 그것은 나에게 오류를 제공합니다 : 오류가 다음과 같다 : 현재 나는 다음이
사전에 전달 모델 항목 유형 '이다 System.Collections.Generic.List
1[User_Manager_Interface.Models.ApplicationUser]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1 [User_Manager_Interface.Models.ApplicationDbContext] '.
보기에 바인딩 된 모델과 전달중인 모델을 확인하십시오. –