示例#1
0
        public ActionResult Detail(int?id)
        {
            ShopBigWheel entity = null;

            if (id == null)
            {
                entity = new ShopBigWheel();
            }
            else
            {
                entity = DB.ShopBigWheel.FindEntity(id);
            }

            return(View(entity));
        }
示例#2
0
        public ActionResult Save(ShopBigWheel entity)
        {
            var json = new JsonHelp();

            try
            {
                if (entity.ID == 0)
                {
                    entity.CreateTime = DateTime.Now;
                    json.IsSuccess    = DB.ShopBigWheel.Insert(entity);
                    json.Msg          = "添加";
                }
                else
                {
                    json.IsSuccess = DB.ShopBigWheel.Update(entity);
                    json.Msg       = "修改";
                }
                if (json.IsSuccess)
                {
                    if (entity.IsEnable == true)
                    {
                        //更新其他的,停用
                        var i = DB.ShopBigWheel.Where(a => a.ID != entity.ID).Update(a => new ShopBigWheel()
                        {
                            IsEnable = false
                        });
                    }
                    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));
        }