public ActionResult History(int contribId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); var deposits = mgr.GetDepositsById(contribId); var contributions = mgr.GetContributionsById(contribId); IEnumerable <Transaction> transactions = deposits.Select(d => new Transaction { Action = "Deposit", Amount = d.Amount, Date = d.Date }).Concat(contributions.Select(c => new Transaction { Action = "Contribution for the " + c.SimchaName + " simcha", Amount = -c.Amount, Date = c.Date })).OrderByDescending(t => t.Date); var vm = new HistoryViewModel(); vm.Transactions = transactions; //List<string> st = new List<string>(); //st.Add("1"); //st.Add("10"); //st.Add("51"); //IEnumerable<int> nums = st.MySelect<string, int>(s => int.Parse(s)); return(View(vm)); }
public ActionResult History(int contribId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); IEnumerable <Deposit> deposits = mgr.GetDepositsById(contribId); IEnumerable <Contribution> contributions = mgr.GetContributionsById(contribId); IEnumerable <Transaction> transactions = deposits.Select(d => new Transaction { Action = "Deposit", Amount = d.Amount, Date = d.Date }).Concat(contributions.Select(c => new Transaction { Action = $"Contribution for the {c.SimchaName} simcha", Amount = -c.Amount, Date = c.Date })).OrderByDescending(t => t.Date); var vm = new HistoryViewModel { Transactions = transactions }; return(View(vm)); }
public ActionResult New(Simcha simcha) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.AddSimcha(simcha); TempData["Message"] = $"New Simcha Created! Id: {simcha.Id}"; return(RedirectToAction("index")); }
public ActionResult UpdateContributions(List <ContributionInclusion> contributors, int simchaId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.UpdateSimchaContributions(simchaId, contributors); TempData["Message"] = "Simcha updated successfully"; return(RedirectToAction("Index")); }
public IActionResult New(Simcha simcha) { var mgr = new SimchaFundManager(_connectionString); mgr.AddSimcha(simcha); TempData["Message"] = $"New Simcha Created! Id: {simcha.Id}"; return(RedirectToAction("index")); }
public ActionResult Edit(Contributor contributor) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.UpdateContributor(contributor); TempData["Message"] = "Contributor updated successfully"; return(RedirectToAction("Index")); }
public IActionResult Deposit(Deposit deposit) { var mgr = new SimchaFundManager(_connectionString); mgr.AddDeposit(deposit); TempData["message"] = "Deposit successfully recorded"; return(RedirectToAction("Index")); }
public IActionResult Edit(Contributor contributor) { var mgr = new SimchaFundManager(_connectionString); mgr.UpdateContributor(contributor); TempData["Message"] = "Contributor updated successfully"; return(RedirectToAction("Index")); }
public ActionResult Deposit(Deposit deposit) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.AddDeposit(deposit); TempData["Message"] = "Deposit of $" + deposit.Amount + " recorded successfully"; return(RedirectToAction("Index")); }
public ActionResult New(string name, DateTime date) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); Simcha simcha = new Simcha { Name = name, Date = date }; mgr.AddSimcha(simcha); TempData["Message"] = "New Simcha Created! Id: " + simcha.Id; return(RedirectToAction("index")); }
public IActionResult Index() { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; } var vm = new ContributorsIndexViewModel(); var mgr = new SimchaFundManager(_connectionString); vm.Contributors = mgr.GetContributors(); return(View(vm)); }
public ActionResult Index() { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; } var vm = new ContributorsIndexViewModel(); var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); vm.Contributors = mgr.GetContributors(); return(View(vm)); }
public IActionResult Index() { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; } var mgr = new SimchaFundManager(_connectionString); var viewModel = new SimchaIndexViewModel(); viewModel.TotalContributors = mgr.GetContributorCount(); viewModel.Simchas = mgr.GetAllSimchas(); return(View(viewModel)); }
public ActionResult Index() { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; } var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); var viewModel = new SimchaIndexViewModel(); viewModel.TotalContributors = mgr.GetContributorCount(); viewModel.Simchas = mgr.GetAllSimchas(); return(View(viewModel)); }
public ActionResult Contributions(int simchaId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); Simcha simcha = mgr.GetAllSimchas().First(s => s.Id == simchaId); //this should be done in the database IEnumerable <SimchaContributor> contributors = mgr.GetSimchaContributorsEasy(simchaId); var viewModel = new ContributionsViewModel { Contributors = contributors, Simcha = simcha }; return(View(viewModel)); }
public ActionResult History(int contribId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); IEnumerable <Deposit> deposits = mgr.GetDepositsById(contribId); IEnumerable <Contribution> contributions = mgr.GetContributionsById(contribId); #region list way without select //List<Transaction> transactions2 = new List<Transaction>(); //foreach (Deposit deposit in deposits) //{ // transactions2.Add(new Transaction // { // Action = "Deposit", // Amount = deposit.Amount, // Date = deposit.Date // }); //} //foreach (Contribution c in contributions) //{ // transactions2.Add(new Transaction // { // Action = "Contribution for the " + c.SimchaName + " simcha", // Amount = -c.Amount, // Date = c.Date // }); //} //transactions2.OrderByDescending(t => t.Date); #endregion IEnumerable <Transaction> transactions = deposits.Select(d => new Transaction { Action = "Deposit", Amount = d.Amount, Date = d.Date }).Concat(contributions.Select(c => new Transaction { Action = "Contribution for the " + c.SimchaName + " simcha", Amount = -c.Amount, Date = c.Date })).OrderByDescending(t => t.Date); var vm = new HistoryViewModel(); vm.Transactions = transactions; Contributor contributor = mgr.GetContributors().First(c => c.Id == contribId); vm.ContributorBalance = contributor.Balance; vm.ContributorName = contributor.FirstName + " " + contributor.LastName; return(View(vm)); }
public IActionResult Contributions(int simchaId) { var mgr = new SimchaFundManager(_connectionString); Simcha simcha = mgr.GetSimchaById(simchaId); IEnumerable <SimchaContributor> contributors = mgr.GetSimchaContributorsOneQuery(simchaId); var viewModel = new ContributionsViewModel { Contributors = contributors, Simcha = simcha }; return(View(viewModel)); }
public ActionResult Contributions(int simchaId) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); Simcha simcha = mgr.GetSimchaById(simchaId); IEnumerable <SimchaContributor> contributors = mgr.GetSimchaContributorsEasy(simchaId); var viewModel = new ContributionsViewModel { Contributors = contributors, Simcha = simcha }; return(View(viewModel)); }
public ActionResult New(Contributor contributor, decimal initialDeposit) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.AddContributor(contributor); var deposit = new Deposit { Amount = initialDeposit, ContributorId = contributor.Id, Date = contributor.Date }; mgr.AddDeposit(deposit); TempData["Message"] = "New Contributor Created! Id: " + contributor.Id; return(RedirectToAction("index")); }
public IActionResult New(Contributor contributor, decimal initialDeposit) { var mgr = new SimchaFundManager(_connectionString); mgr.AddContributor(contributor); var deposit = new Deposit { Amount = initialDeposit, ContributorId = contributor.Id, Date = contributor.Date }; mgr.AddDeposit(deposit); TempData["Message"] = $"New Contributor Created! Id: {contributor.Id}"; return(RedirectToAction("index")); }