public async Task <ActionResult> GetCircleEvents(PaginationParams paginationParams, DateTime?fromDate = null, int circleId = 0, int circleCategoryId = 0, int cityId = 0, int appUserId = 0) { var events = await _repo.GetCircleEvents(paginationParams, fromDate != null?(DateTime)fromDate : default(DateTime), circleId, circleCategoryId, cityId, appUserId); Response.AddPagination(events.CurrentPage, events.PageSize, events.TotalCount, events.TotalPages); var loggedInUser = await GetLoggedInUserAsync(); if (loggedInUser != null) { foreach (var temp in events) { var myParticipation = temp.CircleEventParticipations.FirstOrDefault(cep => cep.AppUserId == loggedInUser.Id); if (myParticipation != null) { temp.MyStatus = myParticipation != null ? (CircleEventParticipationStatus?)myParticipation.Status : null; } } } return(Ok(_mapper.Map <IEnumerable <CircleEventForReturnDto> >(events))); }