public ActionResult DeleteConfirmed(int id) { ICreditRepository repository = new EFCreditRepository(User.Identity.Name); Credit credit = repository.Get(id); repository.Delete(credit); return RedirectToAction("Index"); }
// // GET: /Credit/Edit/5 public ActionResult Edit(int id = 0) { ICreditRepository repository = new EFCreditRepository(User.Identity.Name); Credit credit = repository.Get(id); if (credit == null) { return HttpNotFound(); } return View(credit); }
public ActionResult Create(Credit credit) { ICreditRepository repository = new EFCreditRepository(User.Identity.Name); if (ModelState.IsValid) { repository.Insert(credit); return RedirectToAction("Index"); } return View(credit); }
public ActionResult Year(int year) { ViewBag.PreviousYear = year - 1; ViewBag.Year = year; ViewBag.NextYear = year + 1; ViewBag.DecadeStartYear = year / 10 * 10; ViewBag.DecadeEndYear = year / 10 * 10 + 9; IAssetRepository assetRepository = new EFAssetRepository(User.Identity.Name); ICreditRepository creditRepository = new EFCreditRepository(User.Identity.Name); ProjectionGenerator generator = new ProjectionGenerator(assetRepository, creditRepository); List<DateTime> dateList = new List<DateTime>(); for (int m = 1; m <= 12; m++) { dateList.Add(new DateTime(year, m, 1)); } ProjectionViewModel viewModel = generator.GenerateProjection(dateList, false); return View(viewModel); }
// year = start year public ActionResult Decade(int year) { ViewBag.PreviousYearStart = year - 10; ViewBag.PreviousYearEnd = year - 1; ViewBag.YearStart = year; ViewBag.YearEnd = year + 9; ViewBag.NextYearStart = year + 10; ViewBag.NextYearEnd = year + 19; IAssetRepository assetRepository = new EFAssetRepository(User.Identity.Name); ICreditRepository creditRepository = new EFCreditRepository(User.Identity.Name); ProjectionGenerator generator = new ProjectionGenerator(assetRepository, creditRepository); List<DateTime> dateList = new List<DateTime>(); for (int y = year; y < year + 10; y++) { dateList.Add(new DateTime(y, 1, 1)); } ProjectionViewModel viewModel = generator.GenerateProjection(dateList, true); return View(viewModel); }
// // GET: /Credit/ public ActionResult Index() { ICreditRepository repository = new EFCreditRepository(User.Identity.Name); return View(repository.GetList()); }