public ActionResult Contributors(int? id) { SimchaFundManager manager = new SimchaFundManager(Properties.Settings.Default.ConStr); ContributorsViewModel model = new ContributorsViewModel(); model.Contributer = manager.GetContributors(id).Select(c => new ContributorPageProperties { Contributor = c, Balance = manager.GetBalance(c.Id), }); model.TotalBalance = (double)manager.GetTotalBalance(); return View(model); }
public ActionResult Contribute(int id, int? contributorId) { SimchaFundManager manager = new SimchaFundManager(Properties.Settings.Default.ConStr); ContributeViewModel model = new ContributeViewModel(); model.Simcha = manager.GetASimchas(id); model.Contributors = manager.GetContributors(contributorId).Select(c => new ContributionPageProperties { Contributer = c, Balance = manager.GetBalance(c.Id), AmountContributed = manager.GetContributionAmount(id, c.Id), }); return View(model); }
public ActionResult ShowHistory(int contributorId, int? simchaId) { SimchaFundManager manager = new SimchaFundManager(Properties.Settings.Default.ConStr); ShowHistoryViewModel model = new ShowHistoryViewModel(); string firstName = manager.GetContributors(contributorId).FirstOrDefault(c => c.Id == contributorId).FirstName; string lastName = manager.GetContributors(contributorId).FirstOrDefault(c => c.Id == contributorId).LastName; model.ContributorName = firstName + " " + lastName; model.Balance = manager.GetBalance(contributorId); model.History = manager.GetDeposits(contributorId).Select(d => new ShowHistoryProperties { Name = "Deposit", Date = d.Date, Amount = d.Amount, }).Concat(manager.GetSimchaAndContributors(contributorId, simchaId).Select(s => new ShowHistoryProperties { Name = "Contribution To The " + manager.GetASimchas(s.SimchaId).Name + " Simcha", Date = s.Date, Amount = s.Contribution, })).OrderByDescending(h => h.Date); return View(model); }