public ActionResult History(int contributorId)
        {
            var cManager     = new ContributorManager(Settings.Default.Constr);
            var contributors = cManager.GetContributionsByContributorID(contributorId);
            var deposits     = cManager.GetDepositByContributorId(contributorId);

            IEnumerable <History> historys = contributors.Select(c => new History
            {
                Action = $"Contribution to {c.SimchaName}",
                Date   = c.SimchaDate,
                Amount = c.Amount
            }).Concat(deposits.Select(d => new History
            {
                Action = "Deposit",
                Date   = d.Date,
                Amount = d.DepositAmount
            }));

            var vm = new ShowHistoryViewModel
            {
                Historys    = historys,
                Contributor = cManager.GetContributorById(contributorId)
            };

            return(View(vm));
        }
Esempio n. 2
0
        public ActionResult ShowHistory(int id)//contributor id
        {
            GetFromDB            db = new GetFromDB(Properties.Settings.Default.ConStr);
            ShowHistoryViewModel vm = new ShowHistoryViewModel();

            vm.Contributor  = db.GetContributor(id);
            vm.Transactions = db.GetTransactions(id);
            return(View(vm));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        public IActionResult ShowHistory(int id)
        {
            var db = new SimchaFundDb(_connectionString);
            var vm = new ShowHistoryViewModel
            {
                Contributor = db.GetContributorById(id),
                Actions     = db.GetActions(id)
            };

            vm.Actions = vm.Actions.OrderBy(a => a.Date).ToList <SimchaFund.Data.Action>();

            return(View(vm));
        }
Esempio n. 5
0
        public IActionResult ShowHistory(int id)
        {
            var trip = _context.Trip.FirstOrDefault(x => x.Id == id);
            List <HistoryItemViewModel> history = _context.History.Where(x => x.TripId == id).Select(x => new HistoryItemViewModel {
                Title = x.Title, Date = x.Date, Comment = x.Comment, TripId = x.TripId
            }).ToList();
            var model = new ShowHistoryViewModel()
            {
                TripId  = id,
                History = history
            };

            return(View(model));
        }