I am using SimpleMemberShip. This is the default UserProfile Model:
[Table("UserProfile")]
public class UserProfile
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
}
I want to create a Model to get all user details from the Database across multiple Tables:
public class GetUserDetail
{
[Key]
[ReadOnly(true)]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
public int RoleId { get; set; }
public string RoleName { get; set; }
[ReadOnly(true)]
public DateTime CreateDate { get; set; }
public DateTime PasswordChangedDate { get; set; }
}
Currently is seems not to be possible. I am trying to fill a WebGrid for Admin access on my site. I am sure it can be done some how but maybe I am going about it the wrong way.
this is my Controller:
public ActionResult DashBoard()
{
using (var context = new AppContext())
{
return View(context.GetUserDetails.ToList());
}
}
this is my Context Property:
// Account Model DB Set...
public DbSet<GetUserDetail> GetUserDetails { get; set; }
My WebGrid works if I specify the UserProfile as the model source:
@model List<myApp.Models.UserProfile>
but this does not work:
@model List<myApp.Models.GetUserDetail>
Is it possible to implement a custom Model to span multiple already implemented Tables?
Thank You.