public ActionResult Create(projectClass Obj_project, string command) { using (projectCtl db = new projectCtl()){ if (ModelState.IsValid) { db.insert(Obj_project); 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_project)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (projectCtl db = new projectCtl()){ var ProjectidArray = model.GetValues("item.Projectid"); var BuildingsystemidArray = model.GetValues("item.Buildingsystemid"); var ProjectnameArray = model.GetValues("item.Projectname"); for (Int32 i = 0; i < ProjectidArray.Length; i++) { projectClass obj_update = db.selectById(Convert.ToInt32(ProjectidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(ProjectidArray))) { obj_update.Projectid = Convert.ToInt32(ProjectidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(BuildingsystemidArray))) { obj_update.Buildingsystemid = Convert.ToInt32(BuildingsystemidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(ProjectnameArray))) { obj_update.Projectname = Convert.ToString(ProjectnameArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }
public ActionResult Edit(Int32 Projectid) { using (projectCtl db = new projectCtl()){ projectClass obj_project = db.selectById(Projectid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_project)); } }
public ActionResult Edit(projectClass Obj_project) { using (projectCtl db = new projectCtl()){ if (ModelState.IsValid) { db.update(Obj_project); string sesionval = Convert.ToString(Session["EditPreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("EditPreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } return(View(Obj_project)); } }
public ActionResult Details(Int32 Projectid) { using (projectCtl db = new projectCtl()){ projectClass obj_project = db.selectById(Projectid); return(View(obj_project)); } }