コード例 #1
0
        public ActionResult ClubActivityAdd()
        {
            var model = new C_ClubActivityInfo();
            var bll   = new C_ClubActivityInfoBll();

            if (Request.QueryString["ClubActivityInfoId"] != null)
            {
                model = bll.GetModel(int.Parse(Request.QueryString["ClubActivityInfoId"].ToString()));
            }
            else
            {
                model.ActivityDate = DateTime.Now;
                model.IsShow       = 1;
            }
            return(View(model));
        }
コード例 #2
0
        public Dictionary <string, object> Add(C_ClubActivityInfo model)
        {
            C_ClubActivityInfoBll bll = new C_ClubActivityInfoBll();


            if (model.ClubActivityInfoId > 0)
            {
                var oldmodel = bll.GetModel(model.ClubActivityInfoId);
                model.CreateUserId   = oldmodel.CreateUserId;
                model.CreateUserName = oldmodel.CreateUserName;
                model.CreateTime     = oldmodel.CreateTime;
                if (bll.Update(model) > 0)
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 1 }
                    });
                }
                else
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 0 }
                    });
                }
            }
            else
            {
                model.CreateUserId   = ManageProvider.Provider.Current().UserId;
                model.CreateUserName = ManageProvider.Provider.Current().Account;
                model.CreateTime     = DateTime.Now;
                if (bll.Add(model) > 0)
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 1 }
                    });
                }
                else
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 0 }
                    });
                }
            }
        }