Пример #1
0
        public ContentResult editplayer(PlayerCoachRequest request)
        {
            request.MemberId = UserContext.WebUserContext.Id;
            var msg  = string.Empty;
            var flag = _playerCoachService.Edit(request, out msg);

            return(Result <string>(flag, msg));
        }
Пример #2
0
        public ContentResult insertplayer(PlayerCoachRequest request)
        {
            request.IsPositive = false;
            request.IsCoach    = true;
            request.MemberId   = UserContext.WebUserContext.Id;
            var msg  = string.Empty;
            var flag = _playerCoachService.Insert(request, out msg);

            return(Result <string>(flag, msg));
        }
Пример #3
0
        //绑定教练/学生
        public bool Insert(PlayerCoachRequest request, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request.ObjMemberId <= 0)
                {
                    if (request.IsCoach)
                    {
                        msg = "教练不能为空";
                        return(flag);
                    }
                    else
                    {
                        msg = "学生不能为空";
                        return(flag);
                    }
                }

                if (request.StartDate.IsEmpty())
                {
                    msg = "开始时间不能为空";
                    return(flag);
                }

                var playerCoach = new t_player_coach
                {
                    memberId          = request.MemberId,
                    toMemberId        = request.ObjMemberId,
                    startdate         = request.StartDate,
                    enddate           = request.EndDate,
                    isPositive        = request.IsPositive,
                    isCoach           = request.IsCoach,
                    playerCoachStatus = PlayerCoachStatusEm.待同意,
                };
                _dbContext.Insert(playerCoach);
                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("PlayerCoachService.Insert", ex);
            }
            return(flag);
        }
Пример #4
0
        //编辑绑定教练/学生
        public bool Edit(PlayerCoachRequest request, out string msg)
        {
            bool flag = false;

            msg = string.Empty;
            try
            {
                if (request.StartDate.IsEmpty())
                {
                    msg = "开始时间不能为空";
                    return(flag);
                }

                var playerCoach = _dbContext.Get <t_player_coach>(request.Id);
                if (playerCoach != null && playerCoach.memberId == request.MemberId)
                {
                    playerCoach.startdate         = request.StartDate;
                    playerCoach.enddate           = request.EndDate;
                    playerCoach.playerCoachStatus = PlayerCoachStatusEm.待同意;
                    playerCoach.updatetime        = DateTime.Now;
                    _dbContext.Update(playerCoach);
                    flag = true;
                }
                else
                {
                    msg = "数据不存在";
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("PlayerCoachService.Edit", ex);
            }
            return(flag);
        }