Пример #1
0
        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)));
        }
Пример #2
0
        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());
        }