public Library.Customer GetCustomerById(int customerid) { var result = _context.Customers.Where(x => x.Id == customerid).FirstOrDefault(); Library.Customer customer = new Library.Customer(result.FirstName, result.LastName, result.Id); return(customer); }
public bool AddCustomer(Library.Customer businesscustomer) { // ID left at default 0 Customer customer = new Customer() { FirstName = businesscustomer.FirstName, LastName = businesscustomer.LastName }; _context.Add(customer); return(true); }
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()); } }