public ActionResult Edit(Int32 Materialid) { using (materialCtl db = new materialCtl()){ materialClass obj_material = db.selectById(Materialid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_material)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (materialCtl db = new materialCtl()){ var MaterialidArray = model.GetValues("item.Materialid"); var MaterialnameArray = model.GetValues("item.Materialname"); for (Int32 i = 0; i < MaterialidArray.Length; i++) { materialClass obj_update = db.selectById(Convert.ToInt32(MaterialidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(MaterialidArray))) { obj_update.Materialid = Convert.ToInt32(MaterialidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(MaterialnameArray))) { obj_update.Materialname = Convert.ToString(MaterialnameArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }
public ActionResult Details(Int32 Materialid) { using (materialCtl db = new materialCtl()){ materialClass obj_material = db.selectById(Materialid); return(View(obj_material)); } }