Esempio n. 1
0
        public ActionResult Delete(string id)
        {
            if (_contentService.Delete(id))
            {
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes an item
        /// </summary>
        /// <param name="item"></param>
        /// <typeparam name="T"></typeparam>
        /// <exception cref="MapperException"></exception>
        public void Delete <T>(T item) where T : class
        {
            var type    = GlassContext.GetTypeConfiguration <UmbracoTypeConfiguration>(item) as UmbracoTypeConfiguration;
            var umbItem = type.ResolveItem(item, ContentService);

            if (umbItem == null)
            {
                throw new MapperException("Content not found");
            }

            ContentService.Delete(umbItem);
        }
Esempio n. 3
0
        public async Task <JsonResult> DeleteTask(int id)
        {
            var task = ContentService.Get <TaskItem>(id);

            if (task != null)
            {
                ContentService.Delete(task.Id);
            }

            // push realtime event
            await PushService.Push("task_deleted", task);

            return(Json("Deleted"));
        }
 public ContentDeleteResponse Delete(string id)
 {
     try
     {
         _contentService.Delete(id);
         return(new ContentDeleteResponse());
     }
     catch (Exception ex)
     {
         return(new ContentDeleteResponse
         {
             Success = false,
             Message = ex.Message
         });
     }
 }
Esempio n. 5
0
        public ActionResult Delete(Guid id)
        {
            if (!Request.IsAuthenticated)
            {
                throw new AuthenticationException();
            }

            var content = DataService.PerThread.ContentSet.SingleOrDefault(c => c.Id == id);

            if (content == null)
            {
                throw new BusinessLogicException("Не найден контент с указанным идентификатором");
            }

            ContentService.Delete(id, UserContext.Current.Id);

            return(Redirect(content.GetUrl()));
        }
Esempio n. 6
0
        public async Task <ActionResult> Delete(string path, string returnUrl = "~/")
        {
            await ContentService.Delete(path);

            return(Redirect(returnUrl));
        }