public async Task <NewSupervisorsProjectDTO> CreateProjectPromoter(NewSupervisorsProjectDTO newSupervisors)
        {
            List <Invitation> invitationsToInsert = new List <Invitation>();

            if (newSupervisors.SupervisorEmails.Count > 0)
            {
                for (int i = 0; i < newSupervisors.SupervisorEmails.Count; i++)
                {
                    if (newSupervisors.SupervisorEmails[i] != "")
                    {
                        await searchSupervisorUserAndCreateInvitation(newSupervisors.SupervisorEmails[i], i + 2,
                                                                      newSupervisors.IdProject, invitationsToInsert);
                    }
                }
            }
            else
            {
                throw new HttpResponseException("No data is found");
            }

            if (invitationsToInsert.Count > 0)
            {
                await _invitationRepository.CreateManyInvitations(invitationsToInsert);
            }
            return(newSupervisors);
        }
示例#2
0
        public async Task <IActionResult> CreateNewProjectPromoter(NewSupervisorsProjectDTO newSupervisorsProject)
        {
            try
            {
                await _projectPromoterService.CreateProjectPromoter(newSupervisorsProject);

                return(StatusCode(200));
            }
            catch (HttpResponseException ex)
            {
                return(StatusCode(500, ex.Value));
            }
        }