public ActionResult NewContributor(Contributor contributor, Deposit deposit) { SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); deposit.ContributorId = db.AddContributor(contributor); db.AddDeposit(deposit); return(Redirect("/home/Contributors")); }
public ActionResult AddSimcha(Simcha simcha) { SimchaDb sdb = new SimchaDb(Properties.Settings.Default.ConStr); sdb.AddSimcha(simcha); TempData["SimchaAdded"] = $"{simcha.Name} simcha added"; return(Redirect("/Home/SimchaIndex")); }
public ActionResult AddContributor(string Name, string PhoneNumber, decimal Balance, bool AlwaysInclude, DateTime Date) { SimchaDb sdb = new SimchaDb(Properties.Settings.Default.ConStr); int x = sdb.AddContributor(Name, PhoneNumber, AlwaysInclude, Date); sdb.AddDeposit(x, Balance, Date); return(Redirect("/Contributor/ContributorIndex")); }
public ActionResult ShowHistory(int ContributorId) { ShowHistoryViewModel shvm = new ShowHistoryViewModel(); SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); shvm.Contributor = db.GetContributor(ContributorId); shvm.Transactions = db.GetTransactions(ContributorId); return(View(shvm)); }
public ActionResult Contributors() { ContributorsViewModel cvm = new ContributorsViewModel(); SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); cvm.Contributors = db.GetContributors(); cvm.Balance = db.GetTotalBalance(); return(View(cvm)); }
public ActionResult Index() { IndexViewModel ivm = new IndexViewModel(); SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); ivm.Simchas = db.GetSimchas(); ivm.TotalContributors = db.GetContributorCount(); return(View(ivm)); }
public ActionResult Index() { var db = new SimchaDb(Properties.Settings.Default.ConStr); var vw = new SimchaIndexViewModel { Simchas = db.GetAllSimchas() }; return(View(vw)); }
public ActionResult Contributions(int SimchaId) { SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); ContributionsViewModel cvm = new ContributionsViewModel(); cvm.Simcha = db.GetSimcha(SimchaId); cvm.Contributors = new List <Contributor>(); cvm.Contributors = (List <Contributor>)db.GetContributorsWithContribution(SimchaId); return(View(cvm)); }
public ActionResult Index() { var db = new SimchaDb(Properties.Settings.Default.ConStr); var vm = new ContributersVM { PersonWithBalance = db.GetAllContributers(), TotalBalance = db.GetTotalBalance() }; return(View(vm)); }
public ActionResult ContributionsForSimcha(int simchaId) { ContributionsPageViewModel cpvm = new ContributionsPageViewModel(); SimchaDb sdb = new SimchaDb(Properties.Settings.Default.ConStr); Simcha simcha = sdb.GetSimchaById(simchaId); IEnumerable <SimchaContributor> contributors = sdb.GetSimchaContributors(simchaId); cpvm.Simcha = simcha; cpvm.ContributorsForSimcha = contributors; return(View(cpvm)); }
public ActionResult UpdateContributions(List <ContributionInclude> Contributions, int SimchaId) { SimchaDb db = new SimchaDb(Properties.Settings.Default.ConStr); db.DeleteContributions(SimchaId); List <ContributionInclude> result = Contributions.FindAll(c => c.Include == true); result.ForEach(r => r.SimchaId = SimchaId); result.ForEach(r => db.AddContribution(r)); return(Redirect($"/home/Contributions?SimchaId={SimchaId}")); }
public ActionResult Contributions(List <IncludedContribution> contributions, int simchaId) { List <Contribution> realContributions = contributions.Where(c => c.Included).Select(c => c.Contribution).ToList(); if (realContributions.Count > 0) { var db = new SimchaDb(Properties.Settings.Default.ConStr); db.ClearContributionsToASimcha(simchaId); db.NewContributiosToASimcha(realContributions, simchaId); } return(Redirect("/")); }
public ActionResult History(int contributorId) { SimchaDb sdb = new SimchaDb(Properties.Settings.Default.ConStr); HistoryViewModel hvm = new HistoryViewModel(); IEnumerable <History> contributorHistory = sdb.GetContributionsForContrib(contributorId); IEnumerable <History> depositHistory = sdb.GetDepositsForContrib(contributorId); Contributor contributor = sdb.GetContributorById(contributorId); hvm.History = contributorHistory.Concat(depositHistory).OrderBy(h => h.Date.DayOfYear).ThenBy(h => h.Date.TimeOfDay).ToList(); hvm.Contributor = contributor; return(View(hvm)); }
public ActionResult History(int id) { var db = new SimchaDb(Properties.Settings.Default.ConStr); var vm = new HistoryVM { Trancactions = db.GetTrancactionsById(id), Name = db.GetNameById(id), Balance = db.GetBalanceOfAPerson(id) }; return(View(vm)); }