public ActionResult Users(Users obj) { try { if (obj.chbAuthorizationRights == "on") { obj.chbAuthorizationRights = "true"; } else { obj.chbAuthorizationRights = "false"; } string A = Request.Form["FullName"]; TempData["Msg"] = ""; if (Request.Form["FullName"] != null) { if (obj.UserID > 0) { if (user.Save(obj)) { obj.FullName = ""; TempData["Msg"] = "Update Successfully"; ModelState.Clear(); RedirectToAction("Users", "Users"); } RedirectToAction("Users", "Users"); } else { try { if (user.Save(obj)) { if (obj.UserID > 0) { obj.FullName = ""; TempData["Msg"] = "Update Successfully"; ModelState.Clear(); RedirectToAction("Users", "State"); } TempData["Msg"] = "Save Successfully"; RedirectToAction("Users", "Users"); } } catch (Exception) { } } } } catch (Exception ex) { TempData["Msg"] = ex.Message; return(RedirectToAction("Users", "Users")); } return(RedirectToAction("Users", "Users")); }
private void grdUserOverview_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { DataGridRow _dgRow = e.Row; var _changedValue = _dgRow.DataContext as Users; BL_Users.Save(_changedValue); }
private void DataSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (Users item in e.NewItems) { BL_Users.Save(item); } break; case NotifyCollectionChangedAction.Remove: foreach (Users item in e.OldItems) { BL_Users.Delete(item); } break; } }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (Confirming != null) { Confirming(Model, txtPassword.Password); } try { if (BL_Users.Save(Model)) { if (OnModelSaved != null) { OnModelSaved(Model); } } } catch (Exception) { throw; } }