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