public ActionResult Income(int?id) { if (id == null) { return(HttpNotFound()); } var income = _incomeRepository.GetIncome((int)id); return(View(income)); }
public void Can_Retrieve_Saved_Income_From_Database() { using (var repo = new IncomeRepository(_context)) { _context.Staffs.Add(sampleManager); _context.SaveChanges(); Staff manager = _context.Staffs.Single(); Income income = new Income("Web_Adverts", 2300, manager.Id); repo.Create(income); Income retrievedIncome = repo.GetIncome(manager.Incomes.Single().Id); Assert.AreEqual(2300, retrievedIncome.Amount); } }