public ActionResult Create(Breed breed) { if (ModelState.IsValid) { db.Breeds.Add(breed); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PetTypeId = new SelectList(db.PetTypes, "Id", "Name", breed.PetTypeId); return View(breed); }
public ActionResult Edit(Breed breed) { if (ModelState.IsValid) { db.Entry(breed).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PetTypeId = new SelectList(db.PetTypes, "Id", "Name", breed.PetTypeId); return View(breed); }