public bool RemoveOrder(int id) { if (id <= 0) { throw new Exception("Minimum ID is 1."); } else { return(_orderRepo.DeleteOrder(id)); } }
public ActionResult DeleteOrder(int id) { var orderModelFromRepo = _order.GetOrderById(id); if (orderModelFromRepo == null) { return(NotFound()); } _order.DeleteOrder(orderModelFromRepo); _order.SaveChanges(); return(NoContent()); }
public ActionResult DeleteOrder(int id) { var order = _repoOrder.GetOrderById(id); if (order == null) { return(NotFound()); } _repoOrder.DeleteOrder(order); _repoOrder.SaveChanges(); return(NoContent()); }
public async Task <IActionResult> Delete(string email) { _logger.LogInformation("Delete Order", email); var dbClient = await _clientRepo.ClientFindByEmail(email); var dbOrder = await _orderRepo.GetOrderByClientId(dbClient.Id); _clientRepo.DeleteClient(dbOrder.ClientId); _kadettRepo.DeleteKadett(dbOrder.KadettId); _orderRepo.DeleteOrder(dbOrder.Id); _ticketOrderRepo.DeleteOrderTicket(dbOrder.Id); await _context.SaveChangesAsync(); return(Ok()); }
public OrderResponse DeleteOrder(DateTime date, int orderNum) { bool success = Orepo.DeleteOrder(date, orderNum); OrderResponse resp = new OrderResponse(); resp.Success = success; if (success) { resp.Message = "Order deleted"; } else { resp.Message = "Cannot find the order..."; AddToError(resp.Message); } return(resp); }
public ActionResult DeleteConfirmed(int id) { try { Order order = _repo.GetOrderById((int)id); _bookRepo.ChangeAvailability(order.BookId, "Yes"); _repo.DeleteOrder(id); _repo.SaveChanges(); _bookRepo.SaveChanges(); } catch { return(RedirectToAction("Delete", new { id = id, error = true })); } return(RedirectToAction("MyOrder")); }
public DeleteOrderResponse DeleteOrder(Order orderToDelete) { DeleteOrderResponse response = new DeleteOrderResponse(); _orderRepo.DeleteOrder(orderToDelete); OrderLookupResponse deleteCheck = OrderLookup(orderToDelete.OrderNumber, orderToDelete.OrderDate); if (!deleteCheck.Success) { response.Success = true; } else { response.Success = false; response.Message = "The order was not successfully deleted"; } return(response); }
public IActionResult DeleteOrder(long id) { _orders.DeleteOrder(id); return(Ok()); }
public void DeleteOrder(Orders order) { orderRepo.DeleteOrder(order); }
public void DeleteOrder(Order order) { repo.DeleteOrder(order); }