// DELETE: api/Tasks/5 public HttpResponseMessage Delete(int id) { try { repository.Remove(id); } catch { return(Request.CreateResponse(HttpStatusCode.Conflict)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public void Can_Create_Task_And_Remove_From_Repository() { var repository = new TasksRepository( new ProjectsRepository(ConfigurationManager.ConnectionStrings["TaskTracker"].ConnectionString), new TagsRepository(ConfigurationManager.ConnectionStrings["TaskTracker"].ConnectionString)); var testValue = "TestValue"; var task = new Task { Name = "TestValue" }; var newTask = repository.Save(task); Assert.That(newTask.Id, Is.Not.EqualTo(0)); Assert.That(newTask.Name, Is.EqualTo(testValue)); repository.Remove(task.Id); Assert.That(repository.Find(newTask.Id), Is.Null); }
public async Task <IHttpActionResult> DeleteTask(int id) { await repository.Remove(id); return(Ok()); }