// 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!");
        }
Esempio n. 2
0
        private void DeletePizza(object obj)
        {
            var res = MessageBox.Show("Вы уверены?", "Удаление пиццы", MessageBoxButton.OKCancel);

            if (res == MessageBoxResult.Cancel)
            {
                return;
            }
            pizzaService.Delete(SelectedPizza.PizzaId);
            RefreshPizzas();
        }
Esempio n. 3
0
        public DeletePizzaResponse Delete(int id)
        {
            var response = _service.Delete(id);

            if (response.IsSuccess)
            {
                _uow.Commit();
            }

            return(response.ProjectedAs <DeletePizzaResponse>());
        }
Esempio n. 4
0
        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());
            }
        }
Esempio n. 6
0
        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());
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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 }));
            }
        }
Esempio n. 9
0
 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"));
 }
Esempio n. 11
0
 public IActionResult Delete(int id)
 {
     _pizzaService.Delete(id);
     return(RedirectToAction("Index"));
 }
Esempio n. 12
0
        public async Task <IActionResult> Delete(int id)
        {
            await _pizzaService.Delete(id);

            return(Ok());
        }
Esempio n. 13
0
        public async Task <ActionResult> DeletePizza([FromRoute] int id)
        {
            await _pizzaService.Delete(id);

            return(Ok());
        }