Esempio n. 1
0
 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());
        }
Esempio n. 3
0
        public ActionResult DeleteOrder(int id)
        {
            var order = _repoOrder.GetOrderById(id);

            if (order == null)
            {
                return(NotFound());
            }
            _repoOrder.DeleteOrder(order);
            _repoOrder.SaveChanges();

            return(NoContent());
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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"));
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 public IActionResult DeleteOrder(long id)
 {
     _orders.DeleteOrder(id);
     return(Ok());
 }
 public void DeleteOrder(Orders order)
 {
     orderRepo.DeleteOrder(order);
 }
Esempio n. 10
0
 public void DeleteOrder(Order order)
 {
     repo.DeleteOrder(order);
 }