예제 #1
0
        public OrderResponse RemoveOrder(Order order)
        {
            OrderResponse response = new OrderResponse();
            var           repo     = OrderFactory.CreateOrderRepository();

            if (repo.Remove(order))
            {
                response.Success   = true;
                response.OrderInfo = order;
            }
            else
            {
                response.Success = false;
                response.Message = $"Failed to remove order.";
            }

            return(response);
        }
예제 #2
0
        public OrderResponse GetOrderbyDateAndNumber(DateTime orderDate, string orderNumber)
        {
            OrderResponse response = new OrderResponse();

            var repo  = OrderFactory.CreateOrderRepository();
            var order = repo.GetOrderByDateAndNumber(orderDate, orderNumber);

            if (order != null)
            {
                response.Success   = true;
                response.OrderInfo = order;
            }
            else
            {
                response.Success = false;
                response.Message = $"No Orders found with number: {orderNumber}";
            }

            return(response);
        }
예제 #3
0
        public OrderResponse GetOrder(DateTime orderDate)
        {
            OrderResponse response = new OrderResponse();

            var repo  = OrderFactory.CreateOrderRepository();
            var order = repo.GetOrdersByDate(orderDate);

            if (order != null)
            {
                response.Success   = true;
                response.OrderList = order;
            }
            else
            {
                response.Success = false;
                response.Message = $"No Orders found with date: {orderDate.ToShortDateString()}";
            }

            return(response);
        }
예제 #4
0
        public OrderResponse AddOrder(Order order)
        {
            OrderResponse response = new OrderResponse();

            var repo = OrderFactory.CreateOrderRepository();

            repo.GetOrders();

            // order.OrderNumber = orders.FirstOrDefault(a => a.OrderNumber);

            if (repo.Add(order))
            {
                response.Success   = true;
                response.OrderInfo = order;
            }
            else
            {
                response.Success = false;
                response.Message = "Failed to Add Order.";
            }

            return(response);
        }