Example #1
0
        public void SearchForLocation()
        {
            Console.WriteLine("Enter location Name");
            Location foundLocation = _storeBL.GetLocationByName(Console.ReadLine());

            Console.WriteLine(foundLocation.ToString());
        }
 /// <summary>
 /// allows for the placing of new orders from the customer profile
 /// </summary>
 /// <param name="newOrder"></param>
 /// <returns></returns>
 public ActionResult PlaceOrder(OrderCRVM newOrder)
 {
     if (ModelState.IsValid)
     {
         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());
         }
     }
     else
     {
         return(View());
     }
 }
 // GET: LocationController/Details/5
 /// <summary>
 /// view the details of the specific locations
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public ActionResult Details(string name)
 {
     return(View(_mapper.cast2LocationCRVM(_partsBL.GetLocationByName(name))));
 }