public EditFoundPetVM GetEditPetVM(int id) { FoundPet foundPet = this.Context.FoundPets.FirstOrDefault(p => p.Id == id); EditFoundPetVM vm = Mapper.Map <FoundPet, EditFoundPetVM>(foundPet); return(vm); }
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")); }