public ActionResult DeleteConfirmed(int id) { tblBreed tblBreed = db.tblBreeds.Find(id); db.tblBreeds.Remove(tblBreed); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "BreedID,BreedName,SpeciesID")] tblBreed tblBreed) { if (ModelState.IsValid) { db.Entry(tblBreed).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SpeciesID = new SelectList(db.tblSpecies, "SpeciesID", "SpeciesName", tblBreed.SpeciesID); return(View(tblBreed)); }
public ActionResult Create([Bind(Include = "BreedID,BreedName,SpeciesID")] tblBreed tblBreed) { if (ModelState.IsValid) { db.tblBreeds.Add(tblBreed); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SpeciesID = new SelectList(db.tblSpecies, "SpeciesID", "SpeciesName", tblBreed.SpeciesID); return(View(tblBreed)); }
// GET: tblBreeds/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblBreed tblBreed = db.tblBreeds.Find(id); if (tblBreed == null) { return(HttpNotFound()); } return(View(tblBreed)); }
// GET: tblBreeds/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblBreed tblBreed = db.tblBreeds.Find(id); if (tblBreed == null) { return(HttpNotFound()); } ViewBag.SpeciesID = new SelectList(db.tblSpecies, "SpeciesID", "SpeciesName", tblBreed.SpeciesID); List <vBreed> BreedList = (from Breed in db.vBreeds where Breed.BreedID == id select Breed).ToList(); return(View(tblBreed)); }