Ejemplo n.º 1
0
        public virtual ActionResult SaveContent(AdGenViewModel model)
        {
            Content content = model.Content;
            content.CampaignID = model.SelectedCampaignId;
            adgenRepository.CreateOrUpdateContent(content);

            return RedirectToAction(MVC.AdGen.Index());
        }
Ejemplo n.º 2
0
        public virtual ActionResult AddContent()
        {
            var viewModel = new AdGenViewModel
            {
                Content = new Content(),
                Campaigns = adgenRepository.GetAllCampaigns()
            };

            return View(viewModel);
        }
Ejemplo n.º 3
0
        public virtual ActionResult EditContent(int id)
        {
            var viewModel = new AdGenViewModel
            {
                Content = adgenRepository.GetContentById(id),
                Campaigns = adgenRepository.GetAllCampaigns(),
            };
            viewModel.SelectedCampaignId = viewModel.Content.CampaignID;

            return View(viewModel);
        }
Ejemplo n.º 4
0
        public void CanSaveContent()
        {
            // Arrange
            var fakeRepo = Substitute.For<IAdgenRepository>();
            var controller = new AdGenController(fakeRepo);
            var fakeViewModel = new AdGenViewModel { Content = new Content(), SelectedCampaignId = 0 };

            // Act
            controller.SaveContent(fakeViewModel);

            // Assert
            fakeRepo.Received().CreateOrUpdateContent(fakeViewModel.Content);
        }