예제 #1
0
        public async Task <ActionResult> List()
        {
            var user = await _userRepository.GetUser(User.Identity.Name);

            var promos = new List <ResPromoList>();

            foreach (var org in user.Organisations)
            {
                var organisation = await _organisationRepository.Get(org.ToString());

                var orgPromos = await _promoRepository.GetByOrg(org);

                foreach (var promo in orgPromos)
                {
                    var status = promo.Status;
                    promos.Add(new ResPromoList
                    {
                        Id               = promo.Id,
                        Category         = promo.Category,
                        Title            = promo.Title,
                        From             = promo.From,
                        To               = promo.To,
                        OrganisationName = organisation.Name,
                        StatusText       = "Draft"
                    });
                }
            }
            return(View(promos));
        }