public ActionResult DeleteConfirmed(int id) { LocalHackDay.Models.Charge charge = db.Charges.Find(id); db.Charges.Remove(charge); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ChargeID,Name,Price,BillID")] LocalHackDay.Models.Charge charge) { if (ModelState.IsValid) { db.Entry(charge).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BillID = new SelectList(db.Bills, "BillID", "BillID", charge.BillID); return(View(charge)); }
public ActionResult Create([Bind(Include = "ChargeID,Name,Price")] LocalHackDay.Models.Charge charge) { if (ModelState.IsValid) { db.Charges.Add(charge); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BillID = new SelectList(db.Bills, "BillID", "BillID", charge.BillID); return(View(charge)); }
// GET: Charge/Charges/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocalHackDay.Models.Charge charge = db.Charges.Find(id); if (charge == null) { return(HttpNotFound()); } return(View(charge)); }
// GET: Charge/Charges/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocalHackDay.Models.Charge charge = db.Charges.Find(id); if (charge == null) { return(HttpNotFound()); } ViewBag.BillID = new SelectList(db.Bills, "BillID", "BillID", charge.BillID); return(View(charge)); }