public async Task <PagedResult <User> > GetUsers(string guid)
        {
            var specification = new UserGroupSpecification(guid);
            var groupRepo     = await GetSingleBySpec(specification);

            //var result = await _appDbContext.Users.Where(u => u.UsersGroup.Any(ug => ug.GroupId == groupRepo.Id)).ToListAsync();
            PagedResult <User> result = _appDbContext.Users.Where(u => u.UsersGroup.Any(ug => ug.GroupId == groupRepo.Id)).GetPaged <User, User>(_mapper, 1, 1);

            return(result);
        }
Beispiel #2
0
        public async Task <ActionResult> GetUserGroup(string id)
        {
            if (id == null)
            {
                return(BadRequest(ModelState));
            }
            var specification = new UserGroupSpecification(id);
            var entity        = await _groupRepository.GetSingleBySpec(specification);

            var result = new JsonContentResult();

            result.StatusCode = (int)HttpStatusCode.OK;
            result.Content    = JsonSerializer.SerializeObject(entity);
            return(result);
        }