public ActionResult ContentsDelete(string Id)
        {
            Account loginAccount = membership.GetUser();

            //未登录
            if (loginAccount == null)
            {
                return(RedirectToAction("Index", "Login", null));
            }

            Contents picOld = contentsBll.GetContentsById(int.Parse(Id));

            picOld.IsDelete = 1;
            contentsBll.EditContents();

            ContentsLog logModel = new ContentsLog();

            logModel.OpType           = "删除";
            logModel.ContentsID       = int.Parse(Id);
            logModel.BfTitleUpdate    = picOld.Title;
            logModel.BfContentsUpdate = picOld.XContents;
            logModel.AddDate          = DateTime.Now;
            logModel.AccountUser      = loginAccount.Mobile;
            contentsLogBll.AddContentsLog(logModel);

            return(RedirectToAction("ContentsList"));
        }
        public JsonResult ContentsEdit(string Id, string title, string contents)
        {
            JsonResult js = new JsonResult();

            Account loginAccount = membership.GetUser();

            //未登录
            if (loginAccount == null)
            {
                js.Data = "false";
                return(js);
            }
            string oldTitles   = "";
            string oldContents = "";

            Contents picOld = contentsBll.GetContentsById(int.Parse(Id));

            oldTitles        = picOld.Title;
            oldContents      = picOld.XContents;
            picOld.Title     = title;
            picOld.XContents = contents;

            contentsBll.EditContents();

            //日志
            ContentsLog logModel = new ContentsLog();

            logModel.OpType           = "修改";
            logModel.ContentsID       = int.Parse(Id);
            logModel.BfTitleUpdate    = oldTitles;
            logModel.BfContentsUpdate = oldContents;
            logModel.ATitleUpdate     = title;
            logModel.AfContentsUpdate = contents;
            logModel.AddDate          = DateTime.Now;
            logModel.AccountUser      = loginAccount.Mobile;
            contentsLogBll.AddContentsLog(logModel);


            js.Data = "true";
            return(js);
        }
        public JsonResult ContentsAdd(string title, string contents)
        {
            JsonResult js = new JsonResult();

            Account loginAccount = membership.GetUser();

            //未登录
            if (loginAccount == null)
            {
                js.Data = "false";
                return(js);
            }

            Contents contentModel = new Contents();

            contentModel.Title       = title;
            contentModel.XContents   = contents;
            contentModel.AddDate     = DateTime.Now;
            contentModel.IsDelete    = 0;
            contentModel.AccountUser = loginAccount.Mobile;
            contentsBll.AddContents(contentModel);

            //日志
            ContentsLog logModel = new ContentsLog();

            logModel.OpType           = "新增";
            logModel.ContentsID       = contentModel.ID;
            logModel.BfTitleUpdate    = title;
            logModel.BfContentsUpdate = contents;
            logModel.AddDate          = DateTime.Now;
            logModel.AccountUser      = loginAccount.Mobile;
            contentsLogBll.AddContentsLog(logModel);

            js.Data = "true";
            return(js);
        }
 /// <summary>
 /// 添加内容日志
 /// </summary>
 /// <param name="ContentsLog">内容日志实体</param>
 /// <remarks></remarks>
 public void AddContentsLog(ContentsLog ContentsLog)
 {
     db.ContentsLog.Add(ContentsLog);
     db.SaveChanges();
 }