//Create
 public void AddCustomer(Customer newCustomer)
 {
     try
     {
         dal.Add(newCustomer);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public override UserModule Add(long firstId, long secondId)
 {
     return(Dal.Add(new UserModule()
     {
         UserId = firstId, ModuleId = secondId
     }));
 }
Esempio n. 3
0
        private void AddCustomer()
        {
            Console.WriteLine("Add a new customer");
            Console.WriteLine("Please provide customer details");

            Customer customer = new Customer();

            customer.FirstName = GetName("First name: ");
            customer.LastName = GetName("Last name: ");

            Console.Write("Email: ");
            customer.Email = Console.ReadLine();

            Console.Write("Password: "******"Customer {customer.FirstName} added");
            }
            else
            {
                Console.WriteLine($"Customer {customer.FirstName} already exists in database, add canceled");
            }
        }
Esempio n. 4
0
        private void PlaceOrder() {
            Console.WriteLine("Place order for customer");
            Customer customer = GetCustomer();
            Location location = GetLocation();

            Order order = GetOrder( customer );
            Dal.Add(order);
            GetProductOrders(customer, location, order);
        }
Esempio n. 5
0
        private void GetProductOrders(Customer customer, Location location, Order order)
        { 
            List<Inventory> inventory = Dal.GetInventory(location);
            List<Product> products = Dal.GetProducts();

            bool customerIsOrdering = true;
            int maxOrderLimit = 5;
            while (customerIsOrdering)
            {
                ProductOrder po = new ProductOrder();
                po.Order = order;
                Console.WriteLine($"Products in {location.City}");
                for (int i = 0; i < products.Count; ++i)
                {
                    Console.Write($"{i}: ");
                    Console.Write($"Product = {inventory[i].Product.Name} ");
                    Console.Write($"Quantity = {inventory[i].Quantity} ");
                    Console.WriteLine($"Price = {inventory[i].Product.Price}");
                    Console.WriteLine();
                }

                int productSelected = GetInt($"Enter a product by number (0 - {products.Count - 1})", 0, products.Count - 1);
                if (inventory[productSelected].Quantity == 0)
                    Console.WriteLine($"{inventory[productSelected].Product.Name} is out of stock");
                else
                {
                    int currentQuantity = inventory[productSelected].Quantity;
                    int lowestAmount = (maxOrderLimit > currentQuantity) ? currentQuantity : maxOrderLimit;
                    int quantitySelected = GetInt($"Enter a quantity (up to {lowestAmount})", 1, lowestAmount);

                    po.Product = products[productSelected];
                    po.Quantity = quantitySelected;
                    Dal.Add(po);
                    Console.WriteLine("Product added to order");
                }
                customerIsOrdering = GetBool("Would you like to order something else?");
            }
        }
Esempio n. 6
0
 public int Add(blog_tb_Photo entity, blog_tb_Exif exif)
 {
     return(Dal.Add(entity, exif));
 }