public async Task <IActionResult> GetAllUserZones(ZoneListFilterViewModel filterViewModel)
        {
            var currentIdentityUser = await _userManager.GetUserAsync(User);

            var currentPersonId = currentIdentityUser.PersonId;

            var filter = Mapper.Map <ZoneListFilter>(filterViewModel);
            var zones  = _zoneService.GetZonesByPersonId(currentPersonId, filter);

            return(Json(zones));
        }
Пример #2
0
        public async Task <IActionResult> GetAllUserZones(ZoneListFilterViewModel filterViewModel)
        {
            var currentIdentityUser = await _userManager.GetUserAsync(User);

            var currentPersonId = currentIdentityUser.PersonId;

            var filter = Mapper.Map <ZoneListFilter>(filterViewModel);
            var zones  = _zoneService.GetZonesByPersonId(currentPersonId, filter);

            var viewModels = Mapper.Map <ICollection <ZoneListItemViewModel> >(zones);

            foreach (var vm in viewModels)
            {
                var activeRequest = _zoneValidationRequestService.GetActiveZoneRequest(vm.Id);
                vm.ValidationRequestId = activeRequest?.Id;
            }

            return(Json(viewModels));
        }