public IActionResult Delete(int id) { try { var search = new OrderSearch { Id = id }; _deleteOrders.Execute(search); return(Ok()); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public IActionResult Delete(int id) { try { var search = new OrderSearch { Id = id }; _deleteOrders.Execute(search); return(Redirect("~/Orders")); } catch (EntityNotFoundException e) { TempData["message"] = e.Message; return(Redirect("~/Orders")); } catch (Exception e) { TempData["message"] = e.Message; return(Redirect("~/Orders")); } }