Example #1
0
        public async Task <IActionResult> GetGroups([FromQuery] UserParams userParams)
        {
            var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            var usersFromRepo = await _repo.GetUser(currentUserId);

            userParams.UserId = currentUserId;

            var groups = await _repo.GetGroups(userParams);

            var groupsToReturn = _mapper.Map <IEnumerable <GroupForListDto> >(groups);

            Response.AddPagination(groups.CurrentPage, groups.PageSize, groups.TotalCount, groups.TotalPages);

            return(Ok(groupsToReturn));
        }