Пример #1
0
        public JsonResult RejectMgr(int id)
        {
            JsonModel jm = new JsonModel();

            if (ModelState.IsValid)
            {
                IUserSocialCircleBLL UserSocialCircleBll = BLLFactory <IUserSocialCircleBLL> .GetBLL("UserSocialCircleBLL");

                var UserSocialCircle = UserSocialCircleBll.GetEntity(m => m.Id == id);
                if (UserSocialCircle != null)
                {
                    UserSocialCircle.ApplyStatus = 2;
                    UserSocialCircleBll.Update(UserSocialCircle);
                }
                else
                {
                    jm.Msg = "该用户不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult ApplyJoin(int Id)
        {
            JsonModel jm     = new JsonModel();
            var       userId = GetCurrentUser().Id;

            try
            {
                IUserSocialCircleBLL userSocialCircleBll = BLLFactory <IUserSocialCircleBLL> .GetBLL("UserSocialCircleBLL");

                //如果还没通过过申请
                if (!userSocialCircleBll.Exist(us => us.UserId == userId && us.SocialCircleId == Id && us.ApplyStatus == ConstantParam.IsVerified_YES))
                {
                    var userSocialCircle = userSocialCircleBll.GetEntity(us => us.UserId == userId && us.SocialCircleId == Id &&
                                                                         us.ApplyStatus == ConstantParam.IsVerified_DEFAULT);
                    //如果已申请,正在等待审核
                    if (userSocialCircle != null)
                    {
                        userSocialCircle.ApplyTime = DateTime.Now;
                        userSocialCircleBll.Update(userSocialCircle);
                    }
                    else
                    {
                        R_UserSocialCircle us = new R_UserSocialCircle()
                        {
                            UserId         = GetCurrentUser().Id,
                            SocialCircleId = Id,
                            ApplyStatus    = ConstantParam.IsVerified_DEFAULT,
                            ApplyTime      = DateTime.Now
                        };
                        userSocialCircleBll.Save(us);
                    }
                }
                else
                {
                    jm.Msg = "您已加入该圈子啦";
                }
            }
            catch
            {
                jm.Msg = "请求发生异常";
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }