public ActionResult Edit2(FormCollection collection) { string SysOptionName = "LockDate";//collection["SysOptionName"].ToString(); var data = _dataobject._db.SysOptions.Where(m => m.SysOptionName == SysOptionName).SingleOrDefault(); data.SysOptionValue = collection["SysOptionValue"].ToString(); //FcSysOptionLockDateMessage try { int outputId = _dataobject.Update(data); ViewBag.FcSysOptionLockDateMessage = "succeeded"; //return Content("succeeded"); } catch (Exception ex) { //return Content(string.Format("failed: {0}", ex.Message)); ModelState.AddModelError("", ex.Message); } string rolename = Services.GlobalVariant.GetAppUser().RoleName; if (!"Systems.Administrators".Contains(rolename)) { return(PartialView(this._roleview)); } var result = _dataobject._db.Database.SqlQuery <Models.SysOption>( @"select * from SysOption where SysOptionName in ( 'LockDate' )").ToList(); return(PartialView("Update2", result)); }
public ActionResult Edit2(FormCollection collection) { string SysOptionName = collection["SysOptionName"].ToString(); var data = _dataobject._db.SysOptions.Where(m => m.SysOptionName == SysOptionName).SingleOrDefault(); if (collection["SysOptionValue"] != null) { data.SysOptionValue = collection["SysOptionValue"].ToString(); } else { data.SysOptionValue = collection["SysOptionValue[]"].ToString(); } try { int outputId = _dataobject.Update(data); return(Content("succeeded")); } catch (Exception ex) { return(Content(string.Format("failed: {0}", ex.Message))); } }