Exemplo n.º 1
0
        public ActionResult Save(ShopArticle entity)
        {
            var json = new JsonHelp();

            entity.IsCheck = true;
            try
            {
                if (entity.ID == 0)
                {
                    json.IsSuccess = DB.ShopArticle.Insert(entity);
                    json.Msg       = "添加";
                }
                else
                {
                    json.IsSuccess = DB.ShopArticle.Update(entity);
                    json.Msg       = "修改";
                }
                if (json.IsSuccess)
                {
                    json.ReUrl = ControllerPath + "/Index";   //注册成功就跳转到 激活页
                    json.Msg  += "成功";
                }
                else
                {
                    json.Msg += "失败";
                }
            }
            catch (Exception e)
            {
                json.IsSuccess = false;
                json.Msg       = "操作失败";
                LogHelper.Error("保存商城文章失败:" + WebTools.getFinalException(e));
            }
            return(Json(json));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 浏览量++
        /// </summary>
        /// <param name="ID">文章主键ID</param>
        /// <returns></returns>
        public int ClicksAdd(int ID)
        {
            ShopArticle model = DB.ShopArticle.FindEntity(q => q.ID == ID);

            if (model != null)
            {
                model.Clicks++;
                DB.ShopArticle.Update(model);
                return(model.Clicks);
            }
            return(0);
        }
Exemplo n.º 3
0
        public ActionResult Detail(int?id)
        {
            ShopArticle entity = null;

            ViewBag.List = DB.ShopArticleCategory.getFrom2Layer();
            if (id == null)
            {
                entity = new ShopArticle()
                {
                    CreateTime = DateTime.Now, IsShow = true
                };
            }
            else
            {
                entity = DB.ShopArticle.FindEntity(id);
            }

            return(View(entity));
        }