コード例 #1
0
ファイル: ShopController.cs プロジェクト: wangxiaoyi12/Web
        public ActionResult Save(DataBase.Shop entity)
        {
            var json = new JsonHelp();

            try
            {
                if (entity.ID == 0)
                {
                    var member = DB.Member_Info.FindEntity(a => a.Code == entity.MemberCode);
                    if (member != null)
                    {
                        entity.MemberID = member.MemberId;
                        entity.NickName = member.NickName;
                    }
                    else
                    {
                        json.Msg = "会员编号不存在";
                        return(Json(json));
                    }
                    entity.CreateTime = DateTime.Now;
                    json.IsSuccess    = DB.Shop.Insert(entity);
                    json.Msg          = "添加";
                }
                else
                {
                    var old = DB.Shop.FindEntity(entity.ID);
                    entity.IsCheck  = old.IsCheck;
                    entity.IsEnable = old.IsEnable;
                    WebTools.CopyToObject(entity, old);

                    json.IsSuccess = DB.Shop.Update(old);
                    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));
        }
コード例 #2
0
ファイル: ShopController.cs プロジェクト: wangxiaoyi12/Web
        public ActionResult Detail(int?id)
        {
            DataBase.Shop entity = null;
            if (id == null)
            {
                entity = new DataBase.Shop()
                {
                    IsEnable = true
                };
            }
            else
            {
                entity = DB.Shop.FindEntity(id);
            }

            return(View(entity));
        }
コード例 #3
0
 public ActionResult Index()
 {
     DataBase.Shop entity = DB.Shop.FindEntity(a => a.MemberID == CurrentUser.Id);
     if (entity == null)
     {
         entity = new DataBase.Shop()
         {
             IsEnable = true
         };
         ViewBag.IsCheck = "未开通";
     }
     else
     {
         entity          = DB.Shop.FindEntity(entity.ID);
         ViewBag.IsCheck = entity.IsCheck ? "已审核" : "未审核";
     }
     return(View(entity));
 }
コード例 #4
0
        public ActionResult Save(DataBase.Shop entity)
        {
            var json = new JsonHelp();

            try
            {
                if (entity.ID == 0)
                {
                    entity.MemberID   = CurrentUser.Id;
                    entity.NickName   = CurrentUser.Name;
                    entity.MemberCode = CurrentUser.LoginName;

                    entity.CreateTime = DateTime.Now;
                    json.IsSuccess    = DB.Shop.Insert(entity);
                }
                else
                {
                    var model = DB.Shop.FindEntity(entity.ID);
                    WebTools.CopyToObject(entity, model);
                    entity.CheckTime = DateTime.Now;
                    entity.IsCheck   = true;
                    json.IsSuccess   = DB.Shop.Update(model);
                }
                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));
        }