public IActionResult EditGuestbookCategory(GuestbookCategory model)
        {
            if (model.Id <= 0)
            {
                tip.Message = "错误参数传递!";
                return(Json(tip));
            }
            GuestbookCategory oldentity = GuestbookCategory.Find(GuestbookCategory._.Id == model.Id);

            if (oldentity == null)
            {
                tip.Message = "系统找不到本记录!";
                return(Json(tip));
            }
            if (string.IsNullOrEmpty(model.KindName))
            {
                tip.Message = "请输入留言分类标题!";
                return(Json(tip));
            }
            model.Update();
            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "编辑留言分类成功";
            Core.Admin.WriteLogActions("编辑留言分类(" + model.Id + ");");
            return(Json(tip));
        }
        public IActionResult GuestbookCategorys()
        {
            IList <GuestbookCategory> list = GuestbookCategory.FindAll(null, GuestbookCategory._.Rank.Asc(), null, 0, 0);

            Core.Admin.WriteLogActions("查看留言分类列表页面;");
            return(View(list));
        }
        public IActionResult GuestbookList()
        {
            IList <GuestbookCategory> list = GuestbookCategory.FindAll(null, GuestbookCategory._.Rank.Asc(), null, 0, 0);

            ViewBag.ListKinds = list;
            return(View());
        }
 public IActionResult AddGuestbookCategory(GuestbookCategory model)
 {
     if (string.IsNullOrEmpty(model.KindName))
     {
         tip.Message = "请输入留言分类标题!";
         return(Json(tip));
     }
     model.Insert();
     tip.Status  = JsonTip.SUCCESS;
     tip.Message = "添加成功!";
     Core.Admin.WriteLogActions("添加留言分类(" + model.Id + ");");
     return(Json(tip));
 }
        public IActionResult EditGuestbook(int id)
        {
            IList <GuestbookCategory> list = GuestbookCategory.FindAll(GuestbookCategory._.Id > 0, GuestbookCategory._.Rank.Asc(), null, 0, 0);

            ViewBag.ListKinds = list;
            Guestbook entity = Guestbook.Find(Guestbook._.Id == id);

            if (entity == null)
            {
                return(EchoTipPage("系统找不到本记录!"));
            }
            if (entity.IsRead != 1)
            {
                entity.IsRead = 1;
                entity.Update();
            }

            Core.Admin.WriteLogActions("查看/回复留言(" + id + ");");

            return(View(entity));
        }
        public JsonResult DelGuestbookCategory(int id)
        {
            GuestbookCategory entity = GuestbookCategory.Find(GuestbookCategory._.Id == id);

            if (entity == null)
            {
                tip.Message = "系统找不到本留言分类!";
                return(Json(tip));
            }
            //删除栏目下所有留言
            IList <Guestbook> list = Guestbook.FindAll(Guestbook._.KId == entity.Id, null, null, 0, 0);

            if (list != null && list.Count > 0)
            {
                list.Delete();
            }
            Core.Admin.WriteLogActions("删除留言分类(id:" + entity.Id + ");");
            entity.Delete();
            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "删除留言分类成功";
            return(Json(tip));
        }