I have a table of units as below:
public class Unity
{
public int Id {get;set }
public string Name{ get; set; }
}
public class UsersRight
{
public int Id {get;set }
public string Name{ get; set; }
public int Value{ get; set; }
}
Each user can have access to 1 or n units. I'll have a list with the unit logs.
var userRight = new List<UsersRight>;
userRight = _DAL.UserRights(user);
var listUser = new List<Unity>;
foreach (var item in userRight)
{
listUser.add( new Unity(Name = item.Name, Id = item.Value));
}
What is the most efficient way to do this with EF? I am using ASP.NET Identity.