// DELETE /api/pizza/5 public string Delete(int id) { var pizzaExcluir = _pizzaServico.GetById(id); pizzaExcluir.Ingredients.Clear(); _pizzaServico.Save(pizzaExcluir); _pizzaServico.Delete(id); return("Pizza [" + id + "] apagada com sucesso!"); }
private void DeletePizza(object obj) { var res = MessageBox.Show("Вы уверены?", "Удаление пиццы", MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { return; } pizzaService.Delete(SelectedPizza.PizzaId); RefreshPizzas(); }
public DeletePizzaResponse Delete(int id) { var response = _service.Delete(id); if (response.IsSuccess) { _uow.Commit(); } return(response.ProjectedAs <DeletePizzaResponse>()); }
public IActionResult Delete([FromRoute] int id) { var result = _pizzaService.Delete(id); if (result) { return(NoContent()); } else { return(NotFound()); } }
public IActionResult Delete([FromRoute] int id) { bool isDeleteSuccessful = pizzaService.Delete(id); if (isDeleteSuccessful) { return(NoContent()); } else { return(NotFound()); } }
public IHttpActionResult Delete(int id) { var result = _pizzaService.Delete(id); if (result.IsFailure) { return(StatusCode(HttpStatusCode.InternalServerError)); } if (result.Value) { return(StatusCode(HttpStatusCode.NoContent)); } return(NotFound()); }
public ActionResult <SuccessResponse> Delete(int id) { SuccessResponse response = null; ActionResult result = null; try { _pizzaService.Delete(id); response = new SuccessResponse(); result = Ok(response); } catch (Exception ex) { result = StatusCode(500, new ErrorResponse(ex.Message)); } return(result); }
public IActionResult Delete(string name) { if (string.IsNullOrEmpty(name)) { return(new ObjectResult(new { Status = 400, Value = "Pizza name can't be empty" })); } try { pizzaService.Delete(new Pizza() { Name = name }); return(new ObjectResult(new { Status = 200, Value = string.Format("Pizza {0} deleted", name) })); } catch (Exception exception) { return(new ObjectResult(new { Status = 500, Value = exception.Message })); } }
public IHttpActionResult Delete(int id) { // delete _pizzaService.Delete(id); return(StatusCode(HttpStatusCode.NoContent)); }
public IActionResult Delete(int id) { _pizzaService.Delete(id); return(StatusCode(StatusCodes.Status200OK, "Pizza was succesufuly deleted")); }
public IActionResult Delete(int id) { _pizzaService.Delete(id); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int id) { await _pizzaService.Delete(id); return(Ok()); }
public async Task <ActionResult> DeletePizza([FromRoute] int id) { await _pizzaService.Delete(id); return(Ok()); }