Exemple #1
0
        public void AddOrder()
        {
            OrderOperations orderOperations = new OrderOperations();

            orderOperations.LoadOrdersFromFile();
            var request = new AddEntryRequest();

            CreateOrderRequest(request);///not quite sure on the order
            orderOperations.CreateOrder(request);
        }
Exemple #2
0
        public void CreateOrderRequest(AddEntryRequest request)
        {
            Validate validate = new Validate();

            Console.WriteLine("ORDER ENTRY");
            Console.WriteLine();


            request.CustomerName = validate.PromptforString("Enter customer name: ");
            request.State        = validate.PromptforState("Please enter the state abbreviation: IN, PA, MI, OH");
            request.ProductType  = validate.PromptforProduct("Please Enter a product: Wood, Tile, Laminate, Carpet ");
            request.Area         = validate.PromptforDecimal("Please Enter the Area:");
            request.OrderDate    = validate.PromptforDate("Please enter the Date MM/DD/YYYY");
            Console.Clear();
            Console.WriteLine(@"Your order details are:
Customer Name: {0}
State: {1}
Product Type: {2}
Area: {3:n0}
Order Date: {4}", request.CustomerName, request.State, request.ProductType, request.Area, request.OrderDate);

            Console.WriteLine();

            Console.WriteLine("Would you like to add this order? (Y)es or (N)o?");
            string newOrderReply = Console.ReadLine().ToUpper();

            if (newOrderReply == "Y")
            {
                OrderOperations orderOperations = new OrderOperations();
                orderOperations.CreateOrder(request);
            }

            else
            {
                DisplayMenu returnToMain = new DisplayMenu();
                returnToMain.MainMenu();
            }
        }
 public ActionResult <string> CreateOrder(CreateOrderRequest request)
 {
     return(Ok(OrderOperations.CreateOrder(request.customerId, request.addressId)));
 }