private void DeleteUser() { _Service.DeleteUser(SelectedVM.Id); GetUsers(); OnPropertyChanged(nameof(UserViewModels)); }
public void GetUsersTest() { UserCRUD userService = new UserCRUD(new TestDataRepository()); userService.AddUser(16, "Wartłomiej", "Błodarski"); userService.AddUser(19, "Kaciej", "Mopa"); userService.AddUser(22, "Wartłomiej", "Bubicki"); IEnumerable <UserDTO> users = userService.GetAllUsers(); Assert.AreEqual(users.Count(), 3); userService.DeleteUser(16); userService.DeleteUser(19); userService.DeleteUser(22); }
public void AddUserTest() { UserCRUD userService = new UserCRUD(new TestDataRepository()); Assert.IsTrue(userService.AddUser(67, "Jan", "Paweł the second")); Assert.IsTrue(userService.DeleteUser(67)); }
public void GetUserTest() { UserCRUD userService = new UserCRUD(new TestDataRepository()); userService.AddUser(88, "Chloe", "Price"); Assert.AreEqual(userService.GetUser(88).FirstName, "Chloe"); userService.DeleteUser(88); }
public void UpdateUserTest() { UserCRUD userService = new UserCRUD(new TestDataRepository()); userService.AddUser(11, "Max", "Verstappen"); Assert.IsTrue(userService.UpdateLastName(11, "Caulfield")); Assert.AreEqual(userService.GetUser(11).LastName, "Caulfield"); Assert.IsTrue(userService.UpdateFirstName(11, "Timothy")); Assert.AreEqual(userService.GetUser(11).FirstName, "Timothy"); userService.DeleteUser(11); }
public ActionResult Eliminar(User modelo) { var userName = User.Identity.GetUserId(); int userID = 0; using (var context = new DataContext()) { userID = (from s in context.Usuarios where s.username == userName select s.ID).Single(); operations.DeleteUser(modelo.ID); if (userID == modelo.ID) { var AuthenticationManager = HttpContext.GetOwinContext().Authentication; AuthenticationManager.SignOut(); return(RedirectToAction("Login", "Home")); } else { var search = (from s in context.Usuarios select s).ToList(); return(View("VisualizarUsuarios", search)); } } }
public void DeleteUser(int userId) { UserCRUD userCrud = new UserCRUD(); userCrud.DeleteUser(userId); }