public async Task <IActionResult> GetById(Guid id) { var tasks = new List <Task>(); var @event = _eventsApi.GetById(id); tasks.Add(@event); Task <ApiSuccessResponse <GetAttendeeInfoResponse> > attendeeInfo = default; if (User.Identity.IsAuthenticated) { attendeeInfo = _eventsApi.AttendeeInfo(id); tasks.Add(attendeeInfo); } await Task.WhenAll(tasks); var group = await _groupsApi.GetById(@event.Result.Result.Group.Id); var response = new ApiSuccessResponse <GetEventByIdCompositionResponse> { Code = 200, Result = new GetEventByIdCompositionResponse { Event = @event.Result.Result, Group = group.Result, AttendeeInfo = User.Identity.IsAuthenticated ? attendeeInfo.Result.Result : new GetAttendeeInfoResponse() } }; return(Ok(response)); }
public async Task <IActionResult> GetById(Guid id) { var tasks = new List <Task>(); var group = _groupsApi.GetById(id); tasks.Add(group); Task <ApiSuccessResponse <GetMemberInfoResponse> > memberInfo = default; if (User.Identity.IsAuthenticated) { memberInfo = _groupsApi.MemberInfo(id); tasks.Add(memberInfo); } await Task.WhenAll(tasks); var response = new ApiSuccessResponse <GetGroupByIdCompositionResponse> { Code = 200, Result = new GetGroupByIdCompositionResponse { Group = group.Result.Result, MemberInfo = User.Identity.IsAuthenticated ? memberInfo.Result.Result : new GetMemberInfoResponse() } }; return(Ok(response)); }