public User AddFlow(decimal amount, Category category, string comment, bool IsSpending, User user)
        {
            // TODO add data attribute to the IFlow interface, so we can plot graphs using that data
            if (IsSpending)
            {
                var spending = new Spending(amount, category, comment, user.UID, category.ID, DateTime.Now);
                Data.GetSpendings(spending);
                user.OverallBalance -= amount;
                Data.SaveData();

                return(user);
            }
            else
            {
                var income = new Income();
                income.Category      = category;
                income.Amount        = amount;
                income.Comment       = comment;
                income.UID           = user.UID;
                income.CatId         = category.ID;
                income.TransactionDt = DateTime.Now;
                Data.GetIncomes(income);
                user.OverallBalance += amount;
                Data.SaveData();

                return(user);
            }
        }
Beispiel #2
0
 public void GetSpendings(Spending spending)
 {
     losses.Add(spending);
     SaveData();
 }