示例#1
0
 public ActionResult DeleteConfirmed(int id)
 {
     LocalHackDay.Models.Charge charge = db.Charges.Find(id);
     db.Charges.Remove(charge);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#2
0
 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));
        }
示例#4
0
 // 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));
 }
示例#5
0
 // 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));
 }