public static Boolean Buy(string username, string productName, int quantity) { try { Product p = StoreLogicData.GetProduct(productName); Customer c = StoreLogicData.GetCustomer(username); if (c.Buy(quantity * p.Price) && p.Buy(quantity)) { c.AddOrder(new Order(p.Name, quantity, p.Price * quantity)); return(true); } return(false); } catch (NullReferenceException) { return(false); } }
public static IEnumerable <Product> GetProducts() { return(StoreLogicData.GetProducts().Where(p => p.Stock > 0)); }
public static double GetCustomerMoney(string username) { return(StoreLogicData.GetCustomer(username).Money); }
public static IEnumerable <Order> GetOrdersByUsername(string username) { return(StoreLogicData.GetCustomer(username).Orders); }
public static Boolean Register(Customer c) { return(StoreLogicData.AddCustomer(c)); }