public IActionResult Deposit(Deposit deposit)
        {
            SFundDb db = new SFundDb(_connectionString);

            db.AddDeposit(deposit);
            return(Redirect("/Contributors/Index"));
        }
Пример #2
0
        public IActionResult New(Simcha simcha)
        {
            SFundDb db = new SFundDb(_connectionString);

            db.AddSimcha(simcha);
            return(Redirect("/Home/Index"));
        }
        public IActionResult Edit(Contributor contributor)
        {
            SFundDb db = new SFundDb(_connectionString);

            db.EditContributor(contributor);
            return(Redirect("/Contributors/Index"));
        }
        public IActionResult Index()
        {
            SFundDb db = new SFundDb(_connectionString);
            ContributionsViewModel vm = new ContributionsViewModel();

            vm.Contributors = db.GetContributors();
            return(View(vm));
        }
Пример #5
0
        public IActionResult Contributions(int Id)
        {
            SFundDb db = new SFundDb(_connectionString);
            ContributionsViewModel vm = new ContributionsViewModel();

            vm.Simcha              = db.GetSimcha(Id);
            vm.Contributors        = db.GetContributors();
            vm.SimchaContributions = db.GetContributions().Where(c => c.SimchaId == Id).ToList();
            return(View(vm));
        }
Пример #6
0
        public IActionResult Index()
        {
            SFundDb          db = new SFundDb(_connectionString);
            SimchasViewModel vm = new SimchasViewModel();

            vm.Simchas          = db.GetSimchas();
            vm.ContributorCount = db.GetContributors().Count;
            vm.Contributions    = db.GetContributions();
            return(View(vm));
        }
        public IActionResult History(int id)
        {
            SFundDb db = new SFundDb(_connectionString);
            ContributorHistoryViewModel vm           = new ContributorHistoryViewModel();
            List <Transaction>          transactions = db.GetDeposits(id);

            if (db.GetContributions(id) != null)
            {
                transactions.AddRange(db.GetContributions(id));
            }
            vm.Transactions = transactions;
            vm.Contributor  = db.GetContributor(id);
            return(View(vm));
        }
        public IActionResult New(Contributor contributor, int amount, DateTime createdDate)
        {
            SFundDb db = new SFundDb(_connectionString);

            db.AddContributor(contributor);
            Deposit deposit = new Deposit
            {
                ContributorId = contributor.Id,
                Date          = createdDate,
                Amount        = amount
            };

            db.AddDeposit(deposit);
            return(Redirect("/Contributors/Index"));
        }
Пример #9
0
        public IActionResult UpdateContributions(List <Contribution> contributions)
        {
            SFundDb db = new SFundDb(_connectionString);

            db.ClearContributions(contributions[0].SimchaId);
            foreach (var contribution in contributions)

            {
                if (contribution.AddContributionId == contribution.ContributorId)
                {
                    db.AddContribution(contribution);
                }
            }

            return(Redirect("/Home/Index"));
        }