public ActionResult DeleteConfirmed(int id) { CustomerPets customerPets = db.CustomerPets.Find(id); db.CustomerPets.Remove(customerPets); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,CustomerId,PetId")] CustomerPets customerPets) { if (ModelState.IsValid) { db.Entry(customerPets).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", customerPets.CustomerId); ViewBag.PetId = new SelectList(db.Pets, "Id", "Name", customerPets.PetId); return(View(customerPets)); }
// GET: CustomerPets/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerPets customerPets = db.CustomerPets.Find(id); if (customerPets == null) { return(HttpNotFound()); } return(View(customerPets)); }
// GET: CustomerPets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerPets customerPets = db.CustomerPets.Find(id); if (customerPets == null) { return(HttpNotFound()); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", customerPets.CustomerId); ViewBag.PetId = new SelectList(db.Pets, "Id", "Name", customerPets.PetId); return(View(customerPets)); }