Exemplo n.º 1
0
        public ActionResult CreatePOST()
        {
            if (!Services.Authorizer.Authorize(Permissions.ManageAdvertise, T("Couldn't create advertise")))
            {
                return(new HttpUnauthorizedResult());
            }

            var advertise = Services.ContentManager.New <AdvertisePart>("Advertise");

            _contentManager.Create(advertise, VersionOptions.Draft);
            var model = _contentManager.UpdateEditor(advertise, this);

            if (!ModelState.IsValid)
            {
                _transactionManager.Cancel();
                return(View(model));
            }

            _contentManager.Publish(advertise.ContentItem);
            return(Redirect(Url.AdvertiseForAdmin(advertise)));
        }