public EditLostPetVM GetEditPetVM(int id) { LostPet lostPet = this.Context.LostPets.FirstOrDefault(p => p.Id == id); EditLostPetVM vm = Mapper.Map <LostPet, EditLostPetVM>(lostPet); return(vm); }
public ActionResult Edit(int id) { string username = User.Identity.Name; if (this.service.PetBelongsToUser(username, id) || User.IsInRole("Admin")) { EditLostPetVM vm = this.service.GetEditPetVM(id); return(View(vm)); } return(RedirectToAction("index", "home")); }