Ejemplo n.º 1
0
        public void SearchForCustomer()
        {
            Console.WriteLine("Enter your Phone Number(in form(xxx)xxx-xxxx):");
            Customer foundCustomer = _storeBL.GetCustomerByNumber(Console.ReadLine());

            if (foundCustomer == null)
            {
                Console.WriteLine("no such customer exists try making a new one");
            }
            else
            {
                Console.WriteLine(foundCustomer.ToString());
            }
            Console.WriteLine(currentCustomer.ToString());
            currentCustomer    = foundCustomer;
            currentCustomer.Id = foundCustomer.Id;
        }
Ejemplo n.º 2
0
        public ActionResult Create(OrderCRVM newOrder)
        {
            newOrder.CustomerId = _partsBL.GetCustomerByNumber(newOrder.CustomerNumber).Id;
            newOrder.LocaitonId = _partsBL.GetLocationByName(newOrder.LocationName).Id;
            Product p = new Product();

            p = _partsBL.GetProductByName(newOrder.ProductName);
            newOrder.Total     = p.Price * newOrder.Quantitiy;
            newOrder.ProductId = p.Id;

            try
            {
                _partsBL.AddOrder(_mapper.cast2Order(newOrder));
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
 /// <summary>
 /// Allows the user to see the Customer details based on the user number
 /// </summary>
 /// <param name="number"></param>
 /// <returns></returns>
 public ActionResult Details(string number)
 {
     return(View(_mapper.cast2CustomerCRVM(_partsBL.GetCustomerByNumber(number))));
 }