public IHttpActionResult Delete(int id) { var groupTeamMethods = new GroupTeamMethods(); if (groupTeamMethods.Find(id) == null) { return BadRequest("The item doesn't exist."); } else { groupTeamMethods.Delete(id); return ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent)); } }
public void TestDelete() { var groupTeamMethods = new GroupTeamMethods(); var lastItemOfTheList = groupTeamMethods.Display().LastOrDefault().GroupTeamId; // deleto o item que quero groupTeamMethods.Delete(lastItemOfTheList); // tento encontrar o item que deletei var responseFind = groupTeamMethods.Find(lastItemOfTheList); // se for nulo, significa que o item foi apagado e o método funciona Assert.IsNull(responseFind); }
public IHttpActionResult Delete(int id) { var groupTeamMethods = new GroupTeamMethods(); if (groupTeamMethods.Find(id) == null) { return(BadRequest("The item doesn't exist.")); } else { groupTeamMethods.Delete(id); return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent))); } }