Exemplo n.º 1
0
        public ActionResult PetProfile(string id)
        {
            this.VerifySessionVariables();

            Pet pet = null;

            try
            {
                pet = _petDataLoader.GetPetByCode(id);
            }
            catch (Exception ex)
            {
                this.SetAlertMessageInTempData(AlertMessageTypeEnum.Error, "Hubo un error en el proceso.");
                return(RedirectToAction("Index"));
            }

            if (pet == null)
            {
                this.SetAlertMessageInTempData(AlertMessageTypeEnum.Error, "La Mascota no existe.");
                return(RedirectToAction("Index"));
            }

            var model = _petMapper.PetToProfileViewModel(pet);

            model.SexTypes = GetSexTypes();
            SetPetProfileNavBarInfo(pet, "PetProfile");

            this.SetAlertMessageInViewBag();
            return(View(model));
        }
Exemplo n.º 2
0
        public PagedResponseViewModel <PetProfileViewModel> GetPetsPagedByOwner(int ownerId, int pageSize, int pageNumber)
        {
            var petsPaged = _petServiceClient.GetPetsPagedByOwnerId(ownerId, pageSize, pageNumber);

            return(new PagedResponseViewModel <PetProfileViewModel>
            {
                Result = petsPaged.Result.ConvertAll(x => _petMapper.PetToProfileViewModel(x)),
                TotalPages = petsPaged.TotalPages,
                TotalRecords = petsPaged.TotalRecords
            });
        }