//
        // GET: /ContentKeyword/Details/5

        public ActionResult Details(Guid id)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, read))
            {
                return(RedirectToAction("Index", "Home"));
            }
            ContentKeyword contentkeyword = db.ContentKeywords.Single(c => c.ContentKeywordID == id);

            return(View(contentkeyword));
        }
        //
        // GET: /ContentKeyword/Delete/5

        public ActionResult Delete(Guid id)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, delete))
            {
                return(RedirectToAction("Index", "Home"));
            }
            ContentKeyword contentkeyword = db.ContentKeywords.Single(ck => ck.ContentKeywordID == id && (ck.IsDeleted == null || ck.IsDeleted == false));

            return(View(contentkeyword));
        }
        //
        // GET: /ContentKeyword/Edit/5

        public ActionResult Edit(Guid id)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write))
            {
                return(RedirectToAction("Index", "Home"));
            }
            ContentKeyword contentkeyword = db.ContentKeywords.Single(ck => ck.ContentKeywordID == id && (ck.IsDeleted == null || ck.IsDeleted == false));

            ViewBag.ContentID  = new SelectList(db.ContentItems.Where(c => c.IsDeleted == null || c.IsDeleted == false), "ID", "Title", contentkeyword.ContentID);
            ViewBag.KeywordID  = new SelectList(db.Keywords.Where(k => k.IsDeleted == null || k.IsDeleted == false), "ID", "Keyword1", contentkeyword.KeywordID);
            ViewBag.CreatedBy  = new SelectList(db.Users, "ID", "UserName", contentkeyword.CreatedBy);
            ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", contentkeyword.ModifiedBy);
            return(View(contentkeyword));
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, delete))
            {
                return(RedirectToAction("Index", "Home"));
            }
            ContentKeyword contentkeyword = db.ContentKeywords.Single(ck => ck.ContentKeywordID == id && (ck.IsDeleted == null || ck.IsDeleted == false));

            contentkeyword.ModifiedBy = Guid.Parse(Session["userid"].ToString());
            contentkeyword.ModifiedOn = DateTime.Now;
            contentkeyword.IsDeleted  = true;
            db.ObjectStateManager.ChangeObjectState(contentkeyword, EntityState.Modified);
            db.SaveChanges();
            //db.ContentKeywords.DeleteObject(contentkeyword);

            return(RedirectToAction("Index"));
        }
 public ActionResult Edit(ContentKeyword contentkeyword)
 {
     if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write))
     {
         return(RedirectToAction("Index", "Home"));
     }
     if (ModelState.IsValid)
     {
         contentkeyword.ModifiedBy = Guid.Parse(Session["userid"].ToString());
         contentkeyword.ModifiedOn = DateTime.Now;
         db.ContentKeywords.Attach(contentkeyword);
         db.ObjectStateManager.ChangeObjectState(contentkeyword, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ContentID  = new SelectList(db.ContentItems.Where(c => c.IsDeleted == null || c.IsDeleted == false), "ID", "Title", contentkeyword.ContentID);
     ViewBag.KeywordID  = new SelectList(db.Keywords.Where(k => k.IsDeleted == null || k.IsDeleted == false), "ID", "Keyword1", contentkeyword.KeywordID);
     ViewBag.CreatedBy  = new SelectList(db.Users, "ID", "UserName", contentkeyword.CreatedBy);
     ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", contentkeyword.ModifiedBy);
     return(View(contentkeyword));
 }
示例#6
0
 public void AssertContentKeywordsEqual(ContentKeyword expected, ContentKeyword actual)
 {
     Assert.Equal(expected.id, actual.id);
     Assert.Equal(expected.value, actual.value);
 }