public ExpenseService(ExpenseItContext context, IMapper mapper) { _mapper = mapper; _context = context; //initialize for testing if (_context.Expense.Count() == 0) { var category = new Category() { name = "Mortgage" }; _context.Category.Add(category); var category2 = new Category() { name = "Restaurant" }; _context.Category.Add(category2); var person = new Person() { name = "Roger" }; _context.Person.Add(person); var person2 = new Person() { name = "Rosa" }; _context.Person.Add(person2); _context.Expense.Add(new Expense { name = "Item1", amount = 10, shared = true, category = category, person = person }); _context.Expense.Add(new Expense { name = "Item2", amount = 20, shared = false, category = category2, person = person2 }); _context.SaveChanges(); } }
public PersonService(ExpenseItContext context, IMapper mapper) { _mapper = mapper; _context = context; }
public PersonController(ExpenseItContext context, IMapper mapper) { _service = new PersonService(context, mapper); }
public FrequencyController(ExpenseItContext context, IMapper mapper) { _service = new FrequencyService(context, mapper); }
public RecurringExpenseService(ExpenseItContext context, IMapper mapper) { _mapper = mapper; _context = context; if (!_context.RecurringExpense.Any()) { Person person, person2; Frequency f1, f2; if (!_context.Person.Any()) { person = new Person() { name = "Roger" }; _context.Person.Add(person); person2 = new Person() { name = "Rosa" }; _context.Person.Add(person2); _context.SaveChanges(); } else { person = _context.Person.First(); person2 = _context.Person.Skip(1).First(); } if (!_context.Frequency.Any()) { f1 = new Frequency() { name = "Monthly" }; _context.Frequency.Add(f1); f2 = new Frequency() { name = "Bi-Monthly" }; _context.Frequency.Add(f2); _context.SaveChanges(); } else { f1 = _context.Frequency.First(); f2 = _context.Frequency.Skip(1).First(); } var recurringExpense = new RecurringExpense() { name = "Mortgage", person = person, frequency = f1, amount = 1000, covered = true }; _context.RecurringExpense.Add(recurringExpense); var recurringExpense2 = new RecurringExpense() { name = "Car Payment", person = person2, frequency = f2, amount = 500, covered = false }; _context.RecurringExpense.Add(recurringExpense2); _context.SaveChanges(); } }
public RecurringExpenseController(ExpenseItContext context, IMapper mapper) { _service = new RecurringExpenseService(context, mapper); }
public CalculateService(ExpenseItContext context) { _context = context; }
public ExpenseItController(ExpenseItContext context, IMapper mapper) { _service = new ExpenseService(context, mapper); }
public CategoryService(ExpenseItContext context, IMapper mapper) { _mapper = mapper; _context = context; }
public FrequencyService(ExpenseItContext context, IMapper mapper) { _mapper = mapper; _context = context; }
public CategoryController(ExpenseItContext context, IMapper mapper) { _service = new CategoryService(context, mapper); }
public CalculateController(ExpenseItContext context) { _service = new CalculateService(context); }