public void TestDeleteUser() { var userTeamMethods = new UserTeamMethods(); var lastItemOfTheList = userTeamMethods.Display().LastOrDefault().UserTeamId; // Deleta o item e depois verifica se o id do user está nulo // estando nulo, significa que foi deletado. userTeamMethods.Delete(lastItemOfTheList); Assert.IsNull(userTeamMethods.Find(lastItemOfTheList)); }
public IHttpActionResult Delete(int id) { var userTeamMethods = new UserTeamMethods(); if (userTeamMethods.Find(id) == null) { return BadRequest("The user could not be found."); } else { userTeamMethods.Delete(id); return ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent)); } }
public IHttpActionResult Delete(int id) { var userTeamMethods = new UserTeamMethods(); if (userTeamMethods.Find(id) == null) { return(BadRequest("The user could not be found.")); } else { userTeamMethods.Delete(id); return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent))); } }