public async Task <IActionResult> GetUserRequests(ZoneValidationStatus requestStatus) { var currentIdentityUser = await _userManager.GetUserAsync(User); var currentPersonId = currentIdentityUser.PersonId; var userRequests = _zoneValidationRequestService.GetUserZoneRequests(currentPersonId, requestStatus); var userRequestsListItems = Mapper.Map <ICollection <ZoneValidationRequestListItemViewModel> >(userRequests); foreach (var vm in userRequestsListItems.Where(x => !string.IsNullOrEmpty(x.TargetZoneId))) { var zone = _zoneService.GetZoneById(vm.TargetZoneId); vm.ZoneName = zone.Name; } return(Json(userRequestsListItems)); }
public ICollection <ZoneValidationRequest> GetUserZoneRequests(string currentPersonId, ZoneValidationStatus status) { return(_zoneValidationRequestRepository.GetAll(r => r.RequesterId == currentPersonId && r.Status == status) .OrderByDescending(r => r.Created).ToList()); }