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); }
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); }
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); }
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); }