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

            if (res == MessageBoxResult.Cancel)
            {
                return;
            }
            pizzaService.Delete(SelectedPizza.PizzaId);
            RefreshPizzas();
        }
Пример #3
0
        public DeletePizzaResponse Delete(int id)
        {
            var response = _service.Delete(id);

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

            return(response.ProjectedAs <DeletePizzaResponse>());
        }
Пример #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());
            }
        }
Пример #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());
        }
Пример #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);
        }
Пример #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 }));
            }
        }
Пример #9
0
 public IHttpActionResult Delete(int id)
 {
     // delete
     _pizzaService.Delete(id);
     return(StatusCode(HttpStatusCode.NoContent));
 }
Пример #10
0
 public IActionResult Delete(int id)
 {
     _pizzaService.Delete(id);
     return(StatusCode(StatusCodes.Status200OK, "Pizza was succesufuly deleted"));
 }
Пример #11
0
 public IActionResult Delete(int id)
 {
     _pizzaService.Delete(id);
     return(RedirectToAction("Index"));
 }
Пример #12
0
        public async Task <IActionResult> Delete(int id)
        {
            await _pizzaService.Delete(id);

            return(Ok());
        }
Пример #13
0
        public async Task <ActionResult> DeletePizza([FromRoute] int id)
        {
            await _pizzaService.Delete(id);

            return(Ok());
        }