public User GetUserById(int UserId) { var user = (from u in _ctx.User where u.Id == UserId select MapperUser.Map(u)).FirstOrDefault(); var role = (from r in _ctx.AppRole join u in _ctx.User on r.Id equals u.IdRole where u.Id == UserId select MapperRole.Map(r)).FirstOrDefault(); user.Role = role; return(user); }
public List <User> GetListUser(int GroupId) { return((from ug in _ctx.UserGroup where ug.IdGroup == GroupId select MapperUser.Map(ug.User)).ToList()); }