private static bool AddBudgetRecord(BudgetRecord budgetRecord) { BudgetCollection.Insert(budgetRecord); UpdateIndex(budgetRecord.RecordType == RecordTypeEnum.Income ? budgetRecord.Amount : -budgetRecord.Amount, budgetRecord.Date); return(true); }
public static BudgetRecord GetNewRecord(double amount, RecordTypeEnum recordType, bool regularRecord = false, string description = "") { var budgetRecord = new BudgetRecord() { Date = DateTime.Now, IsActive = true, Amount = amount, RecordType = recordType, Description = description }; return(budgetRecord); }
public static bool AddIncome(double ammount, string description = "") { var newRecord = BudgetRecord.GetNewRecord(ammount, RecordTypeEnum.Income, false, description); return(AddBudgetRecord(newRecord)); }