public ActionResult Create(DogMedication model) { var dog = _dogProfileRepo.GetById(model.DogProfileID); if (dog == null) { return(HttpNotFound()); } if (!ModelState.IsValid) { SetDogViewBag(dog); return(View(model)); } _dogMedicationRepo.Insert(model); return(RedirectToAction("Index", new { dog = model.DogProfileID })); }
public virtual ActionResult Edit(DogMedication med) { if (med == null) { return(HttpNotFound()); } var dog = _dogProfileRepo.GetById(med.DogProfileID); if (dog == null) { return(HttpNotFound()); } if (!ModelState.IsValid) { SetDogViewBag(dog); return(View(med)); } _dogMedicationRepo.Update(med); return(RedirectToAction("Index", new { dog = dog.ProfileID })); }