Beispiel #1
0
        public ActionResult RemoveCollection(int Page_ID, int Collection_ID)
        {
            PageCollectionAssign col = (PageCollectionAssign)db.PageCollectionAssigns.Where(x => x.Collection_ID == Collection_ID && x.Page_ID == Page_ID).FirstOrDefault();

            if (col == null)
            {
                return(HttpNotFound());
            }
            col.Archive_By   = User.Identity.Name.ToString();///TODO: auth
            col.Date_Archive = DateTime.Now;
            col.Archived     = true;
            db.SaveChanges();
            return(RedirectToAction("Edit", new { id = Page_ID }));
        }
        public ActionResult Create([Bind(Include = "Collection_Title,Collection_Description,Display_Mode_ID,Page_ID")] CollectionCreateViewModel collectionViewMod, bool?Return_Home)
        {
            Collection collection = new Collection();

            collection.Collection_Description = collectionViewMod.Collection_Description;
            collection.Collection_Title       = collectionViewMod.Collection_Title;
            collection.Display_Mode_ID        = collectionViewMod.Display_Mode_ID;
            collection.Archived = false;
            db.Collections.Add(collection);
            db.SaveChanges();

            PageCollectionAssign ass = new PageCollectionAssign();

            ass.Collection  = collection;
            ass.Page_ID     = collectionViewMod.Page_ID;
            ass.Archived    = false;
            ass.Date_Added  = DateTime.Now;
            ass.Added_By    = User.Identity.Name.ToString();
            ass.Sequence_No = 9999;
            db.PageCollectionAssigns.Add(ass);
            db.SaveChanges();

            return(RedirectToAction("Edit", new { Collection_ID = collection.Collection_ID, Page_ID = collectionViewMod.Page_ID }));
        }