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 double GetCustomerMoney(string username) { return(StoreLogicData.GetCustomer(username).Money); }
public static IEnumerable <Order> GetOrdersByUsername(string username) { return(StoreLogicData.GetCustomer(username).Orders); }