public IActionResult Create()
        {
            var model = new CampaignModel()
            {
                ClientList  = dropdownObj.GetClients(),
                CountryList = dropdownObj.GetCountries()
            };

            return(View(model));
        }
예제 #2
0
        public CampaignModel GetById(object id)
        {
            var campaign = _campaignRepository.GetById(id);

            if (campaign != null)
            {
                campaign.AdvertisementSuppliers = _suppRepository.GetTable().Where(t => t.CampaignId == campaign.Id).ToList();
            }
            var model = new CampaignModel()
            {
                Name            = campaign.Name,
                AddedBy         = campaign.AddedBy,
                AddedTime       = campaign.AddedTime,
                Budget          = campaign.Budget,
                CampaignModelId = campaign.Id,
                Country         = campaign.Country,
                ClientId        = campaign.ClientId,
                StartDateTime   = campaign.StartDateTime,
                EndDateTime     = campaign.EndDateTime,
                CountryList     = dropDownBLObject.GetCountries(),
                ClientList      = dropDownBLObject.GetClients(),
            };

            if (campaign.AdvertisementSuppliers != null)
            {
                foreach (var supplier in campaign.AdvertisementSuppliers)
                {
                    model.Advertisements.Add(new OMG_Annalect_DomainModels.DomainModel.AdvertisementSupplierModel()
                    {
                        Budget                  = supplier.Budget,
                        StartDateTime           = supplier.StartDateTime,
                        EndDateTime             = supplier.EndDateTime,
                        Name                    = supplier.Name,
                        ChannelName             = _channelRepository.GetById(supplier.ChannelId).Name,
                        SupplierName            = _supplierRepository.GetById(supplier.SupplierId).Name,
                        SupplierId              = supplier.SupplierId,
                        ChannelId               = supplier.ChannelId,
                        AdvertisementSupplierId = supplier.Id
                    });
                }
            }
            else
            {
                campaign.AdvertisementSuppliers = new List <AdvertisementSupplier>();
            }
            return(model);
        }