// DELETE /api/categories/5 public void Delete(int id) { var command = new DeleteCategoryCommand { CategoryId = id }; var result = commandBus.Submit(command); if (!result.Success) throw new HttpResponseException(HttpStatusCode.BadRequest); }
public ActionResult Delete(int id) { var command = new DeleteCategoryCommand { CategoryId = id }; var result = commandBus.Submit(command); var categories = categoryRepository.GetAll(); return PartialView("_CategoryList", categories); }
// DELETE /api/category/5 public HttpResponseMessage Delete(int id) { var command = new DeleteCategoryCommand { CategoryId = id }; var result = commandBus.Submit(command); if (result.Success) { return new HttpResponseMessage(HttpStatusCode.NoContent); } throw new HttpResponseException(HttpStatusCode.BadRequest); }