public ActionResult DeleteConfirmed(int id) { A_Product a_Product = db.A_Product.Find(id); db.A_Product.Remove(a_Product); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "product_code,product_description,strength,packsize,carton_size_pkt,carton_weight_kg,product_category,Basic_Unit,approved_MOH_NTG,approved_WHO,approved_FDA,nda_registration,SAP_code,ConsummableProduct,ART_product_classification,NMS_Codes,ProductStatusId,ProductExpires,TracerCommodity,ProductTypeId")] A_Product a_Product) { if (ModelState.IsValid) { db.Entry(a_Product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.product_category = new SelectList(db.A_product_category, "category_code", "category_desc", a_Product.product_category); return(View(a_Product)); }
// GET: A_Product/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } A_Product a_Product = db.A_Product.Find(id); if (a_Product == null) { return(HttpNotFound()); } return(View(a_Product)); }
// GET: A_Product/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } A_Product a_Product = db.A_Product.Find(id); if (a_Product == null) { return(HttpNotFound()); } ViewBag.product_category = new SelectList(db.A_product_category, "category_code", "category_desc", a_Product.product_category); return(View(a_Product)); }
public ActionResult DialogInsert(A_Product value /*, string testdata, string testdata2, string testdata3*/) { try { var _feedback = db.A_Product.FirstOrDefault(f => f.product_code == value.product_code); db.Configuration.ProxyCreationEnabled = false; if (_feedback == null) { db.A_Product.Add(value); } else { db.Entry(_feedback).CurrentValues.SetValues(value); db.Entry(_feedback).State = EntityState.Modified; } if (value.Basic_Unit == 0) { value.Basic_Unit = null; } var recsaved = db.SaveChanges(); // msg = value.product_description + " Saved Successfully"; return(Json(new { msg = "Successfully added " + value.product_description, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { throw ex; } // return Json(msg, JsonRequestBehavior.AllowGet); }