예제 #1
0
        public ActionResult EditPOST(int advertiseId)
        {
            var advertise = _advertiseService.Get(advertiseId, VersionOptions.DraftRequired);

            if (!Services.Authorizer.Authorize(Permissions.ManageAdvertise, advertise, T("Couldn't edit advertise")))
            {
                return(new HttpUnauthorizedResult());
            }

            if (advertise == null)
            {
                return(HttpNotFound());
            }

            var model = Services.ContentManager.UpdateEditor(advertise, this);

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

            _contentManager.Publish(advertise);
            Services.Notifier.Success(T("Advertise information updated"));

            return(Redirect(Url.AdvertisesForAdmin()));
        }
예제 #2
0
        public ActionResult Remove(int advertiseId)
        {
            if (!Services.Authorizer.Authorize(Permissions.ManageAdvertise, T("Couldn't delete advertise")))
            {
                return(new HttpUnauthorizedResult());
            }

            var advertise = _advertiseService.Get(advertiseId, VersionOptions.Latest);

            if (advertise == null)
            {
                return(HttpNotFound());
            }

            _advertiseService.Delete(advertise);

            Services.Notifier.Success(T("Advertise was successfully deleted"));
            return(Redirect(Url.AdvertisesForAdmin()));
        }