public static void TestDelete() { Test.Business.User UserBusiness = new Business.User(); int result = UserBusiness.Delete(1); Console.WriteLine(result != 0 ? "删除成功" : "删除失败"); }
public void Delete(string id) { Business.User user = Business.User.GetUserById(id); if (user != null) { user.Delete(); this.Bind(null); } else { this.PageEngine.ShowMessageBox(string.Format("没有找到 Id 为 ‘{0}’ 的用户", id)); } }
public void DeleteEntity() { var factory = new Data.RepositoryFactory(); Business.User userBiz = new Business.User(factory); var userFound = userBiz.Get(1); if (userFound == null) userFound = userBiz.Save(FakeEntities.Generator.CreateUser()); int id = userFound.Id; userBiz.Delete(userFound); var userDeleted = userBiz.Get(id); Assert.IsNull(userDeleted); }
private void RemoveBtn_OnClick(object sender, MouseButtonEventArgs e) { removeBtn.Background = Brushes.Red; if (dataGrid.SelectedItem != null) { var result = MessageBox.Show("Deseja remover o dado selecionado?", "Remoção", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { var selectedType = dataGrid.SelectedItem.GetType().Name; if (selectedType == bUser.GetType().Name) { bUser.Delete(dataGrid.SelectedItem as Model.User); UsersBtn_OnClick(sender, e); } else if (selectedType == bAccs.GetType().Name) { bAccs.Delete(dataGrid.SelectedItem as Model.AccessLog); AccsLogBtn_OnClick(sender, e); } } } RemoveBtn_NonClick(sender, e); }
public static bool DeleteUser(Guid userGuid) { Business.User userController = new Business.User(); return(userController.Delete(userGuid)); }
public IActionResult Delete(int id) { userBLL.Delete(id); return(Redirect("/user/list")); }