Ejemplo n.º 1
0
        public ActionResult ViewMyActivity()
        {
            var    repo   = new VerifyRepository(Settings.Default.ConStr);
            Member member = repo.GetByEmail(User.Identity.Name);

            if (member == null)
            {
                return(RedirectToAction("ViewExpenses"));
            }
            var fr = new FinancialRepository(Settings.Default.ConStr);
            IEnumerable <Payment>         payments        = fr.GetPaymentsByMemberId(member.Id);
            IEnumerable <Pledge>          pledges         = fr.GetPledgesByMemberId(member.Id);
            IEnumerable <MonthlyPayment>  monthlyPayments = fr.GetMonthlyPaymentsByMemberId(member.Id);
            IEnumerable <PaymentWithName> pwn             = payments.Select(p => new PaymentWithName
            {
                Amount = p.Amount,
                Date   = p.Date,
                Name   = p.Expense.Name
            });
            IEnumerable <PledgeWithName> plwn = pledges.Select(p => new PledgeWithName
            {
                Id     = p.Id,
                Amount = p.Amount,
                Date   = p.Date,
                Name   = p.Expense.Name
            });
            IEnumerable <MonthlyPaymentWithName> mpwn = monthlyPayments.Select(mp => new MonthlyPaymentWithName
            {
                Amount = mp.Amount,
                Name   = mp.Expense.Name,
                Count  = mp.Count.Value
            });
            PaymentsAndPledges paps = new PaymentsAndPledges
            {
                Payments        = pwn,
                Pledges         = plwn,
                MonthlyPayments = mpwn
            };

            return(View(paps));
        }
Ejemplo n.º 2
0
        public ActionResult GetById(int id)
        {
            FinancialRepository          fr              = new FinancialRepository(Settings.Default.ConStr);
            IEnumerable <Payment>        payments        = fr.GetPaymentsByMemberId(id);
            IEnumerable <Pledge>         pledges         = fr.GetPledgesByMemberId(id);
            IEnumerable <MonthlyPayment> monthlyPayments = fr.GetMonthlyPaymentsByMemberId(id);
            Member m = fr.GetMember(id);
            IEnumerable <PaymentWithName> pwn = payments.Select(p => new PaymentWithName
            {
                Amount = p.Amount,
                Date   = p.Date,
                Name   = p.Expense.Name
            });
            IEnumerable <PledgeWithName> plwn = pledges.Select(p => new PledgeWithName
            {
                Id     = p.Id,
                Amount = p.Amount,
                Date   = p.Date,
                Name   = p.Expense.Name
            });
            IEnumerable <MonthlyPaymentWithName> mpwn = monthlyPayments.Select(mp => new MonthlyPaymentWithName
            {
                Amount = mp.Amount,
                Name   = mp.Expense.Name,
                Count  = mp.Count.Value
            });
            PaymentsAndPledges paps = new PaymentsAndPledges
            {
                Payments        = pwn,
                Pledges         = plwn,
                MonthlyPayments = mpwn,
                Member          = m
            };

            return(View(paps));
        }