Example #1
0
 public ActionResult DeleteWidgetItem(int widgetType,int id)
 {
     using (var context = new ContentStorage())
     {
         var widgetItem = context.Widgets.Select(w => w).Where(w => w.Id == id).FirstOrDefault();
         if (widgetItem != null)
         {
             context.DeleteObject(widgetItem);
             context.SaveChanges();
         }
     }
     return Redirect("~/Widgets/" + widgetType);
 }
Example #2
0
        public ActionResult DeleteArticle(string id)
        {
            using (ContentStorage context = new ContentStorage())
            {
                List<Article> articles = context.Article.Where(a => a.Name == id).ToList();

                foreach (var item in articles)
                {
                    context.DeleteObject(item);
                }
                context.SaveChanges();
            }
            return RedirectToAction("Index", "News");
        }
Example #3
0
 public ActionResult DeleteGalleryItem(int id, string contentId, int galleryId)
 {
     using (var context = new ContentStorage())
     {
         GalleryItems galleryItem = context.GalleryItems.Select(g => g).Where(g => g.Id == id).FirstOrDefault();
         context.DeleteObject(galleryItem);
         context.SaveChanges();
         //return RedirectToAction("Index", "Content", new { id = contentId });
         return Redirect("~/Galleries/" + galleryId);
     }
 }
Example #4
0
        public ActionResult DeleteContentItem(int id)
        {
            using (var context = new ContentStorage())
            {
                Content content = context.Content.Include("Children").Where(c => c.Id == id).FirstOrDefault();
                string contentId = content.ContentId;
                if (content.Children.Count == 0)
                {
                    context.DeleteObject(content);
                    context.SaveChanges();
                }
                return RedirectToAction("Index", "Content", new { id = "About" });
            }

        }
Example #5
0
        public ActionResult DeleteGallery(int id, string contentId)
        {
            using (var context = new ContentStorage())
            {
                Gallery gallery = context.Gallery.Include("GalleryItems").Select(g => g).Where(g => g.Id == id).FirstOrDefault();
                if (gallery.GalleryItems.Count == 0)
                {
                    context.DeleteObject(gallery);
                    context.SaveChanges();
                }
                return RedirectToAction("Index", "Content", new { id = contentId });
                

            }
        }