public BudgetInputRow[] LoadBudgetInputs(string username, BudgetInputTypes budgetInputType) { BudgetDbContext db = new BudgetDbContext(); var user = db.Users .Include(u => u.BudgetInputRows) .Where(u => u.Username == username) .Single(); return(user.BudgetInputRows.Where(bir => bir.Type == budgetInputType).ToArray()); }
internal static List <BudgetInputRow> GetDefaults(BudgetInputTypes type) { List <BudgetInputRow> rows = new List <BudgetInputRow>() { new BudgetInputRow(), new BudgetInputRow() }; //If you update the defaults, also update in budget.service.ts switch (type) { case BudgetInputTypes.Incomes: //Default first row rows[0].Type = type; rows[0].RowNum = 0; rows[0].Label = "Salary"; rows[0].Monthly = 4000; rows[0].PreTax = false; //Default second row rows[1].Type = type; rows[1].RowNum = 1; rows[1].Label = "401k match"; rows[1].Monthly = 100; rows[1].PreTax = true; break; case BudgetInputTypes.Expenses: //Default first row rows[0].Type = type; rows[0].RowNum = 0; rows[0].Label = "Groceries"; rows[0].Monthly = 200; rows[0].PreTax = false; //Default second row rows[1].Type = type; rows[1].RowNum = 1; rows[1].Label = "Health insurance"; rows[1].Monthly = 100; rows[1].PreTax = true; break; case BudgetInputTypes.Savings: //Default first row rows[0].Type = type; rows[0].RowNum = 0; rows[0].Label = "401K"; rows[0].Monthly = 500; rows[0].PreTax = true; //Default second row rows[1].Type = type; rows[1].RowNum = 1; rows[1].Label = "House downpayment"; rows[1].Monthly = 500; rows[1].PreTax = false; break; } return(rows); }