Exemplo n.º 1
0
        public FoundPetVM GetFoundPetVM(string username, int id)
        {
            FoundPet foundPet = this.Context.FoundPets.FirstOrDefault(p => p.Id == id);

            FoundPetVM vm = Mapper.Map <FoundPet, FoundPetVM>(foundPet);

            vm.IsLostPet          = false;
            vm.Comments           = vm.Comments.OrderByDescending(comment => comment.DatePosted);
            vm.AssociatedUsername = username;
            return(vm);
        }
Exemplo n.º 2
0
        public ActionResult ConfirmDelete(int id)
        {
            string username = User.Identity.Name;

            if (this.service.PetBelongsToUser(username, id) || User.IsInRole("Admin"))
            {
                FoundPetVM vm = this.service.GetFoundPetVM(username, id);

                return(View(vm));
            }

            return(RedirectToAction("index", "home"));
        }