public ActionResult DeleteConfirmed(int id) { BuyMachine buyMachine = db.BuyMachines.Find(id); db.BuyMachines.Remove(buyMachine); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,Machine_id,UserName,Phno,Address,Email,Quantity")] BuyMachine buyMachine) { if (ModelState.IsValid) { db.Entry(buyMachine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(buyMachine)); }
public ActionResult Create([Bind(Include = "id,Machine_id,UserName,Phno,Address,Email,Quantity")] BuyMachine buyMachine) { if (ModelState.IsValid) { db.BuyMachines.Add(buyMachine); db.SaveChanges(); TempData["orderresult"] = "Your order has been successfully placed"; } return(View(buyMachine)); }
// GET: BuyMachines/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BuyMachine buyMachine = db.BuyMachines.Find(id); if (buyMachine == null) { return(HttpNotFound()); } return(View(buyMachine)); }