public ActionResult DeleteConfirmed(int id) { cu cu = db.cus.Find(id); db.cus.Remove(cu); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "customerId,customerName,customerEmail,customerPhone")] cu cu) { if (ModelState.IsValid) { db.Entry(cu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cu)); }
public ActionResult Create([Bind(Include = "customerId,customerName,customerEmail,customerPhone")] cu cu) { if (ModelState.IsValid) { db.cus.Add(cu); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cu)); }
public ActionResult Search(string search, cu x) { //if a user choose the radio button option as Subject if (search != "") { //Index action method will return a view with a student records based on what a user specify the value in textbox return(View("Index", db.cus.Where(db => db.customerName == search).ToList())); } else { return(View(db.cus.ToList())); } }
// GET: Customers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } cu cu = db.cus.Find(id); if (cu == null) { return(HttpNotFound()); } return(View(cu)); }