Ejemplo n.º 1
0
        public IActionResult JoinClub(JoinClub1QO newJoinClubQO)
        {
            var       studentId = Utils.GetCurrentUserId(this.User);
            SuccessVO success   = new SuccessVO
            {
                IsSuccess = _studentService.JoinClub(studentId, newJoinClubQO)
            };

            return(Ok(success));
        }
Ejemplo n.º 2
0
        //申请加入社团
        public bool JoinClub(long StudentId, JoinClub1QO newJoinClubQO)
        {
            var test = _context.JoinClub.FirstOrDefault(a =>
                                                        a.ClubId == newJoinClubQO.ClubId && a.StudentId == StudentId);

            if (test != null)
            {
                return(false);                              //检测是否已存在该申请,如果已经存在该就添加失败
            }
            var newJoin = new JoinClub                      //插入新申请,Status初始值为0,待审核
            {
                ClubId      = newJoinClubQO.ClubId,
                StudentId   = StudentId,
                ApplyDate   = DateTime.Now,
                ApplyReason = newJoinClubQO.ApplyReason,
                Status      = false
            };

            _context.JoinClub.Add(newJoin);
            _context.SaveChanges();
            return(true);
        }