Exemplo n.º 1
0
        public EditLostPetVM GetEditPetVM(int id)
        {
            LostPet lostPet = this.Context.LostPets.FirstOrDefault(p => p.Id == id);

            EditLostPetVM vm = Mapper.Map <LostPet, EditLostPetVM>(lostPet);

            return(vm);
        }
Exemplo n.º 2
0
        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"));
        }