public IActionResult EditAdsKind(AdsKind model)
        {
            if (model.Id <= 0)
            {
                tip.Message = "错误参数传递!";
                return(Json(tip));
            }
            AdsKind oldentity = AdsKind.Find(AdsKind._.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 AdsCategoryList()
        {
            IList <AdsKind> list = AdsKind.FindAll(null, AdsKind._.Rank.Asc(), null, 0, 0);

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

            ViewBag.ListKinds = list;
            Core.Admin.WriteLogActions("查看添加广告页面;");
            return(View());
        }
 public IActionResult AddAdsKind(AdsKind 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 EditAds(int id)
        {
            IList <AdsKind> list = AdsKind.FindAll(null, AdsKind._.Rank.Asc(), null, 0, 0);

            ViewBag.ListKinds = list;

            Ads entity = Ads.Find(Ads._.Id == id);

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

            Core.Admin.WriteLogActions("查看/编辑广告(" + id + ");");

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

            if (entity == null)
            {
                tip.Message = "系统找不到本广告分类!";
                return(Json(tip));
            }
            //删除旗下广告
            IList <Ads> list = Ads.FindAll(Ads._.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));
        }