Ejemplo n.º 1
0
        public string Execute(string[] data)
        {
            if (!Validation.CheckLength(2, data))
            {
                return(InvalidLength);
            }

            if (Session.User == null)
            {
                return(NoUser);
            }

            string username = data[1];
            string teamName = data[0];

            if (!userService.Exist(username) || !teamService.Exists(teamName))
            {
                return(NotExist);
            }


            if (!teamService.IsCreator(teamName, Session.User.Username))
            {
                return(NotAllowed);
            }

            if (invitationService.Exists(username, teamName))
            {
                return(InviteAlreadySent);
            }

            invitationService.InviteUser(teamName, username);

            return(String.Format(SuccessMessage, teamName, username));
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Invite([FromQuery] Guid applicationId, [FromForm] NewInvitationModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             await invitationService.InviteUser(model.Email, applicationId);
         }
         catch (AppException e)
         {
             return(RedirectToAction("view", "users", new { applicationId, error = e.Message }));
         }
     }
     return(RedirectToAction("view", "users", new { applicationId }));
 }
Ejemplo n.º 3
0
        public IActionResult InviteAttendeeResult([FromBody] MeetingAttendee attendee)
        {
            var userInfo = User.ToRest();
            var validate = attendee.Validate();

            if (!validate.Condition)
            {
                return(new BadRequestObjectResult(validate.Message));
            }

            attendee.PersonIdentity = attendee.Email;
            attendee.Role           = "Invited";
            attendee.Status         = "Invited";

            var meeting = _getMeetingService.GetMeeting(userInfo.InstanceId, attendee.ReferenceId);

            if (!meeting.Condition)
            {
                return(BadRequest("There was a issue getting the meeting information."));
            }

            var inviteRecords = _invitationService.InviteUser(userInfo, attendee, meeting.Meeting);

            if (!inviteRecords.Condition)
            {
                return(StatusCode(inviteRecords.Code, inviteRecords.Message));
            }

            var notificationResult = _notificationService.SendMeetingInvitation(attendee, meeting.Meeting, userInfo.InstanceId);

            if (notificationResult.Condition)
            {
                return(Ok());
            }

            return(StatusCode(notificationResult.Code, notificationResult.Message));
        }