//private componentCtl db = new componentCtl(); //{privateVariables} public ActionResult Create() { using (componentCtl db = new componentCtl()){ Session["CreatePreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View()); } }
public ActionResult Create(componentClass Obj_component, string command) { using (componentCtl db = new componentCtl()){ if (ModelState.IsValid) { db.insert(Obj_component); if (command.ToLower().Trim() == "save") { string sesionval = Convert.ToString(Session["CreatePreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("CreatePreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } else { ModelState.Clear(); return(View()); } } return(View(Obj_component)); } }
public ActionResult EditTableRowDelete(Int32 Componentid) { using (componentCtl db = new componentCtl()){ db.delete(Componentid); return(RedirectToAction("EditTable")); } }
public ActionResult Delete(Int32 Componentid) { using (componentCtl db = new componentCtl()){ db.delete(Componentid); return(RedirectToAction("Index")); } }
public ActionResult Edit(Int32 Componentid) { using (componentCtl db = new componentCtl()){ componentClass obj_component = db.selectById(Componentid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_component)); } }
public ActionResult EditTableRowsDelete(string records) { using (componentCtl db = new componentCtl()){ foreach (string id in records.Trim(',').Split(',')) { if (!string.IsNullOrEmpty(id.Trim())) { db.delete(Convert.ToInt32(id)); } } return(View()); } }
public ActionResult Edit(componentClass Obj_component) { using (componentCtl db = new componentCtl()){ if (ModelState.IsValid) { db.update(Obj_component); string sesionval = Convert.ToString(Session["EditPreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("EditPreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } return(View(Obj_component)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (componentCtl db = new componentCtl()){ var ComponentidArray = model.GetValues("item.Componentid"); var ComponentnameArray = model.GetValues("item.Componentname"); for (Int32 i = 0; i < ComponentidArray.Length; i++) { componentClass obj_update = db.selectById(Convert.ToInt32(ComponentidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(ComponentidArray))) { obj_update.Componentid = Convert.ToInt32(ComponentidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(ComponentnameArray))) { obj_update.Componentname = Convert.ToString(ComponentnameArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }
public ActionResult Details(Int32 Componentid) { using (componentCtl db = new componentCtl()){ componentClass obj_component = db.selectById(Componentid); return(View(obj_component)); } }
public ActionResult EditTableLazyLoading(Int64 StartIndex, Int64 EndIndex, string Search) { using (componentCtl db = new componentCtl()){ return(PartialView(db.selectIndexLazyLoading(StartIndex, EndIndex, Search))); } }
public Int32 EditTablePagingCount(Int64 PageSize, Int64 PageIndex, string Search) { using (componentCtl db = new componentCtl()){ return(db.selectIndexPagingCount(PageSize, PageIndex, Search)); } }
public ActionResult EditTablePaging(Int64 PageSize, Int64 PageIndex, string Search) { using (componentCtl db = new componentCtl()){ return(PartialView(db.selectIndexPaging(PageSize, PageIndex, Search))); } }