Exemple #1
0
        public async Task <IActionResult> GetCreatedGroups(int?page, int?pageSize)
        {
            var me     = HttpContext.User.Identity.Name;
            var groups = await _groupsRepository.GetCreatedGroups(me, page, pageSize);

            var response = groups.Select(group =>
            {
#pragma warning disable AsyncFixer02 // Long running or blocking operations under an async method
                var lastMessage = _messagesRepository.GetMessagesFromGroup(group.GroupGuid, 0, 1).Result.FirstOrDefault();
#pragma warning restore AsyncFixer02 // Long running or blocking operations under an async method
                return(new GroupFoundWithMessageDto(group, lastMessage));
            });

            return(new OkObjectResult(new { Groups = response }));
        }