Example #1
0
        public IActionResult Donate()
        {
            List <string> ListaKategorii = new List <string>();

            foreach (Institution c in _instytutionService.GetAll())
            {
                ListaKategorii.Add(c.Name);
            }

            DonationViewModel donationViewModel = new DonationViewModel
            {
                DonationQuantity = 1,
                Categories       = (List <Category>)_categoryService.GetAll(),
                Institutions     = _instytutionService.GetAll(),
                Instytucje       = new SelectList(ListaKategorii)
            };

            return(View(donationViewModel));
        }
        public IActionResult Index()
        {
            IEnumerable <Donation> AllDonations = _donationService.GetAll();
            int qq = 0;
            var ii = AllDonations.Select(x => x.Id).Distinct();

            foreach (Donation d in AllDonations)
            {
                qq += d.Quantity;
                //ii += d.Institutions.Id;
            }

            IndexModel indexModel = new IndexModel
            {
                Quantity        = qq,
                AllInstitutions = ii.Count(),
                InstitutionList = _instytutionService.GetAll()
            };

            return(View(indexModel));
        }