Example #1
0
        /// <summary>
        /// Gets an Order based off of a specific OrderId
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ClassLibrary.StoreApplication.Design.Order GetOrderById(int id)
        {
            using var context = new Project0DBContext(_contextOptions);

            var dbOrders = context.Orders
                           .Include(o => o.Location)
                           .Include(o => o.Customer)
                           .Include(o => o.Product)
                           .First(o => o.OrderId == id);

            var location = new ClassLibrary.StoreApplication.Design.Location(dbOrders.LocationId, dbOrders.Location.Name)
            {
                LocationId = dbOrders.LocationId,
                Name       = dbOrders.Location.Name,
            };

            var customer = new ClassLibrary.StoreApplication.Design.Customer()
            {
                CustomerId = dbOrders.CustomerId,
                FirstName  = dbOrders.Customer.FirstName,
                LastName   = dbOrders.Customer.LastName,
                Email      = dbOrders.Customer.Email
            };

            var product = new ClassLibrary.StoreApplication.Design.Product()
            {
                ProductId = dbOrders.ProductId,
                Title     = dbOrders.Product.Name,
                Price     = dbOrders.Product.Price,
            };

            ClassLibrary.StoreApplication.Design.Order testorder = new ClassLibrary.StoreApplication.Design.Order()
            {
                OrderId    = dbOrders.OrderId,
                CustomerId = customer.CustomerId,
                LocationId = location.LocationId,
                ProductId  = product.ProductId,
                OrderTime  = dbOrders.OrderTime,
                Quantity   = dbOrders.Quantity
            };


            return(testorder);
        }
Example #2
0
 public void UpdateLocationInventory(ClassLibrary.StoreApplication.Design.Location location, ClassLibrary.StoreApplication.Design.Product product)
 {
     throw new NotImplementedException();
 }