Example #1
0
        public bool AddStoreLocation(Library.StoreLocation businessstorelocation)
        {
            // ID left at default 0
            StoreLocation storeLocation = new StoreLocation()
            {
                Id          = businessstorelocation.Id,
                Address     = businessstorelocation.Address,
                City        = businessstorelocation.City,
                State       = businessstorelocation.State,
                PhoneNumber = businessstorelocation.PhoneNumber
            };

            _context.Add(storeLocation);

            return(true);
        }
Example #2
0
        public Library.OrderDetails GetOrderDetailsById(int id)
        {
            var result = _context.Orders.Include(x => x.StoreLocation).Include(x => x.Customer).Where(x => x.Id == id).FirstOrDefault();

            if (result != null)
            {
                Library.Customer customer = new Library.Customer(result.Customer.FirstName, result.Customer.LastName, result.CustomerId);

                Library.StoreLocation storeLocation = new Library.StoreLocation(result.StoreLocation.City, result.StoreLocation.State, result.StoreLocation.Address, result.StoreLocation.PhoneNumber, result.StoreLocationId);

                Library.OrderDetails details = new OrderDetails(0, customer, storeLocation, result.TimeCreated.Value);

                return(details);
            }
            else
            {
                return(new OrderDetails());
            }
        }