public async Task <ActionResult <DetailedUser> > Get(int id) { var users = _dbContext.Users.Include(x => x.UserGroup).Include(x => x.UserState); var user = await users.FirstOrDefaultAsync(x => x.UserId == id); if (user == null) { return(NotFound()); } return(new ObjectResult(DetailedUser.ToDetailed(user))); }
public async Task <ActionResult <IEnumerable <DetailedUser> > > Get() { var users = _dbContext.Users.Include(x => x.UserGroup).Include(x => x.UserState); return(await users.Select(x => DetailedUser.ToDetailed(x)).ToListAsync()); }