public ActionResult Create([Bind(Include = "Banner1,Title,Sut_title,Text,Banner_photo_url,Last_updata_date")] Banner banner) { if (ModelState.IsValid) { BannerService service = new BannerService(); var result = service.Create(banner); if (result.IsSuccessful) { return(RedirectToAction("Index")); } } return(View(banner)); }
public void CreateBannerService() { var uow = new UnitOfWork(new DigitalSignageDbContext("DigitalSignageTest")); BannerService cS = new BannerService(); BannerDTO BannerDTO = new BannerDTO(); BannerDTO.Name = "nueva campaña"; BannerDTO.Description = "qsy"; BannerDTO.InitDate = new DateTime().AddYears(2018); BannerDTO.EndDate = new DateTime().AddYears(2018); BannerDTO.InitTime = new TimeSpan(); BannerDTO.EndTime = new TimeSpan(); BannerDTO.Source = new RssSourceDTO() { Description = "fuente rss", Url = "Una url", RssItems = new List <RssItemDTO> { new RssItemDTO() { Description = "item rss", Url = "una url", Title = "titulo", PublishingDate = DateTime.Now } } }; try { cS.Create(BannerDTO); var result = cS.GetAll(); } catch (Exception e) { Assert.Fail(e.Message); } }
public ActionResult <Banner> Create([FromBody] Banner banner) { _bannerService.Create(banner); return(CreatedAtRoute("Get", new { id = banner.Id }, banner)); }