public ActionResult DeleteConfirmed(int id) { 異動記錄 cart_transaction = db.異動記錄.Find(id); db.異動記錄.Remove(cart_transaction); db.SaveChanges(); return(RedirectToAction("Index")); }
public JsonResult _DetailsEditable(異動記錄 data, string field) { 異動記錄 cart_trans = db.異動記錄.Where <異動記錄>(c => c.ID == data.ID).FirstOrDefault <異動記錄>(); cart_trans.GetType().GetProperty(field).SetValue(cart_trans, data.GetType().GetProperty(field).GetValue(data)); db.Entry(cart_trans).State = EntityState.Modified; db.SaveChanges(); return(Json("success")); }
public ActionResult Edit([Bind(Include = "ID,印表機ID,碳粉匣,單價,數量,廠商,入出,日期")] 異動記錄 cart_transaction) { if (ModelState.IsValid) { db.Entry(cart_transaction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.printer_id = new SelectList(db.印表機, "ID", "使用單位", cart_transaction.印表機ID); return(View(cart_transaction)); }
public ActionResult Create([Bind(Include = "ID,印表機ID,碳粉匣,單價,數量,廠商,入出,日期")] 異動記錄 cart_transaction) { if (ModelState.IsValid) { db.異動記錄.Add(cart_transaction); db.SaveChanges(); return(RedirectToAction("Index", "Printers")); } ViewBag.printer_id = new SelectList(db.印表機, "ID", "使用單位", cart_transaction.印表機ID); return(PartialView()); }
public ActionResult _DeleteConfirmed(int id) { 異動記錄 cart_transaction = db.異動記錄.Find(id); db.異動記錄.Remove(cart_transaction); db.SaveChanges(); //List<異動記錄> carts = db.異動記錄.Where(c => c.印表機ID == cart_transaction.印表機ID).Where(c => c.碳粉匣 == cart_transaction.碳粉匣).OrderBy(c => c.日期).ToList(); //if (carts == null) //{ // return HttpNotFound(); //} return(RedirectToAction("Index", "Printers")); }
// GET: cart_transaction/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 異動記錄 cart_transaction = db.異動記錄.Find(id); if (cart_transaction == null) { return(HttpNotFound()); } return(View(cart_transaction)); }
// GET: cart_transaction/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 異動記錄 cart_transaction = db.異動記錄.Find(id); if (cart_transaction == null) { return(HttpNotFound()); } ViewBag.printer_id = new SelectList(db.印表機, "ID", "使用單位", cart_transaction.印表機ID); return(View(cart_transaction)); }