public void ShouldDeleteUser() { var bl = new UsersBL(); bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student); bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei"); User user = bl.GetUser("ohgoahrgorei", "ohgoahrgorei"); Assert.IsNull(user); }
private void DeleteUser(object sender, EventArgs e) { var id = (int)ctlUsersDataGridView.SelectedCells[0].OwningRow.Cells[0].Value; Users.DeleteUser(id); DisplayUsers(); }
public ActionResult DeleteUser(int userId) { var currentuser = users.GetUser().FirstOrDefault(u => u.ID == userId); if (currentuser != null) { users.DeleteUser(currentuser.ID); } return(RedirectToAction("Index", "User")); }
// DELETE: api/Users/5 public IHttpActionResult Delete(int id, [FromBody] Users1 user) { try { UsersBL.DeleteUser(user); return(Ok()); } catch { return(Conflict()); } }
public IHttpActionResult DeleteUser(int id) { ErrorMessage errorMessage = usersBL.DeleteUser(id); if (errorMessage.Code == HttpStatusCode.OK) { return(Ok()); } return(new ResponseMessageResult(Request.CreateErrorResponse( errorMessage.Code, new HttpError(errorMessage.Message) ) )); }
public IHttpActionResult DeleteUser(int id) { objUsers.DeleteUser(id); return(Ok()); }
public void ShouldInsertUserOnlyOnceAndThenDeleteIt() { var bl = new UsersBL(); bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student); bool actual = bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student); bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei"); Assert.IsFalse(actual); Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student)); }
public void ShouldValidateUser() { var bl = new UsersBL(); bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student); Assert.IsTrue(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student)); Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei111", UserTypes.Student)); bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei"); Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student)); }
public void DeleteUser(SPAProjectManager.Entities.Users user) { var userBL = new UsersBL(mockContext); userBL.DeleteUser(user); }