コード例 #1
0
        public async Task <Invitation> searchStudentAndCreateInvitation(String userEmail, int role, int index, int idProject, List <Invitation> invitations)
        {
            var newInvitation = new Invitation();

            var student = await _projectMemberRepository.GetStudentByEmail(userEmail);

            if (student == null)
            {
                throw new HttpResponseException("Project Member " + index +
                                                " Email is not found. Please enter correct student email");
            }
            else
            {
                var invitation = new Invitation
                {
                    Project            = idProject,
                    For_Who            = student.IdUser,
                    Role               = role,
                    IsMemberInvitation = true
                };
                invitations.Add(invitation);
            }

            return(newInvitation);
        }