public IActionResult Delete(string id) { var dish = _dishService.Get(id); if (dish != null) { _dishService.Delete(id); return(RedirectToAction("Index")); } return(NotFound()); }
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); } }
public ActionResult Delete([FromRoute] int id) { _dishService.Delete(id); return(NoContent()); }
public async Task <IActionResult> DeletePOST(int id) { await _dishService.Delete(id); return(RedirectToAction(nameof(Index))); }
public ActionResult Delete(int id) { return(Ok( dishService.Delete(id) )); }
public ActionResult Delete(Guid id) { _dishService.Delete(id); return(RedirectToAction("Index", "Menu")); }
public ActionResult Delete([FromRoute] int restaurantId, [FromRoute] int id) { _service.Delete(restaurantId, id); return(NoContent()); }
public async Task <IActionResult> Delete(Guid id) { await _dishService.Delete(id); return(Ok()); }
protected override void ExecuteCommand() { dishService.Delete(Id); }
/// <summary> /// delete dish /// </summary> /// <param name="id"></param> /// <returns></returns> public IActionResult DeleteDish(int id) { dishService.Delete(id); return(RedirectToAction("Dishes")); }
public RedirectResult Delete(int id) { _dishService.Delete(id); return(Redirect("/Dish/GetAll")); }