Esempio n. 1
0
        public IActionResult ManageBanner(BannerModel model)
        {
            if (_bannerService.GetBanner() == null)
            {
                _bannerService.CreateBanner(model);
            }
            else
            {
                _bannerService.UpdateBanner(model);
            }

            return(PartialView("_ManageBanner", model));
        }
        // POST: api/banner
        public async Task <IHttpActionResult> Post(Banner newBanner)
        {
            if (ModelState.IsValid)
            {
                var banner = await _bannerService.CreateBanner(newBanner);

                if (banner == null)
                {
                    return(BadRequest("Must contain valid html"));
                }
                var location = Request.RequestUri + "/" + banner.Id;
                return(Created(location, banner));
            }

            return(BadRequest());
        }