Ejemplo n.º 1
0
        public EditFoundPetVM GetEditPetVM(int id)
        {
            FoundPet foundPet = this.Context.FoundPets.FirstOrDefault(p => p.Id == id);

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

            return(vm);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            string username = User.Identity.Name;

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

                return(View(vm));
            }


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