Example #1
0
        public IActionResult Delete(string id)
        {
            var dish = _dishService.Get(id);

            if (dish != null)
            {
                _dishService.Delete(id);

                return(RedirectToAction("Index"));
            }

            return(NotFound());
        }
Example #2
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    Dish dish = dishService.Delete(id);
                    dishService.SaveChanges();
                    SaveHistory("Add new Dish with ID: " + dish.ID);
                    response = request.CreateResponse(HttpStatusCode.OK, dish);
                }
                return response;
            }));
        }
        public async Task Delete(int?id)
        {
            var restaurantEntity = await _restaurantRepository.Get(id.Value);

            if (restaurantEntity is null)
            {
                return;
            }

            var meals     = restaurantEntity.Meals;
            var employess = restaurantEntity.Employees;

            await _restaurantRepository.Delete(restaurantEntity);

            foreach (Dish dish in meals)
            {
                await _dishService.Delete(dish.Id);
            }

            foreach (User user in employess)
            {
                await _userService.Delete(user.Id);
            }
        }
Example #4
0
        public ActionResult Delete([FromRoute] int id)
        {
            _dishService.Delete(id);

            return(NoContent());
        }
Example #5
0
        public async Task <IActionResult> DeletePOST(int id)
        {
            await _dishService.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }
Example #6
0
 public ActionResult Delete(int id)
 {
     return(Ok(
                dishService.Delete(id)
                ));
 }
Example #7
0
 public ActionResult Delete(Guid id)
 {
     _dishService.Delete(id);
     return(RedirectToAction("Index", "Menu"));
 }
Example #8
0
        public ActionResult Delete([FromRoute] int restaurantId, [FromRoute] int id)
        {
            _service.Delete(restaurantId, id);

            return(NoContent());
        }
Example #9
0
        public async Task <IActionResult> Delete(Guid id)
        {
            await _dishService.Delete(id);

            return(Ok());
        }
Example #10
0
 protected override void ExecuteCommand()
 {
     dishService.Delete(Id);
 }
Example #11
0
 /// <summary>
 /// delete dish
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public IActionResult DeleteDish(int id)
 {
     dishService.Delete(id);
     return(RedirectToAction("Dishes"));
 }
Example #12
0
 public RedirectResult Delete(int id)
 {
     _dishService.Delete(id);
     return(Redirect("/Dish/GetAll"));
 }