public async Task <IActionResult> Cancel(int id)
        {
            var result = await _inviteService.DeleteInvite(id);

            var response = new ApiResponse <bool>(result);

            return(Ok(response));
        }
Example #2
0
 public static async Task DeleteInvite(string channelId)
 {
     try
     {
         IInviteService channelservice = AuthenticatedRestFactory.GetInviteService();
         var            ch             = await channelservice.DeleteInvite(channelId);
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
Example #3
0
        public async Task <IActionResult> ConfirmEmail(ConfirmEmailViewModel confirmEmailViewModel)
        {
            try
            {
                var ExistingUserName = _userService.GetUserByUserName(confirmEmailViewModel.Email);
                if (confirmEmailViewModel.Password != confirmEmailViewModel.ConfirmPassword)
                {
                    return(BadRequest("Email is not confirmed"));
                }
                else if (ExistingUserName != null)
                {
                    return(BadRequest("UserName already exists"));
                }
                else
                {
                    try
                    {
                        User user = new User();
                        user.Id                   = Guid.NewGuid();
                        user.Email                = confirmEmailViewModel.Email;
                        user.UserName             = confirmEmailViewModel.Email;
                        user.NormalizedUserName   = confirmEmailViewModel.Email;
                        user.NormalizedEmail      = confirmEmailViewModel.Email;
                        user.EmailConfirmed       = true;
                        user.PasswordHash         = _passwordService.Hash(confirmEmailViewModel.Password);
                        user.PhoneNumberConfirmed = false;
                        user.TwoFactorEnabled     = false;
                        user.LockoutEnabled       = false;
                        user.AccessFailedCount    = 0;
                        user.CreationDate         = DateTime.Now;

                        var NewUserId = await _userService.InsertUser(user);

                        var      invite   = _inviteservice.GetInviteByEmailId(confirmEmailViewModel.Email);
                        UserRole userRole = new UserRole();
                        userRole.RoleId = invite.RoleId;
                        userRole.UserId = NewUserId;
                        //await _userRolesService.InsertRoleUser(userRole);
                        var invitedelete = _inviteservice.DeleteInvite(invite.Id);
                        return(Ok(user));
                    }
                    catch (Exception ex)
                    {
                        return(BadRequest(ex.Message));
                    }
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #4
0
        public async Task <IActionResult> Delete(DeleteInvitePayload payload)
        {
            try
            {
                await inviteService.DeleteInvite(payload, this.UserId);

                return(Ok());
            }
            catch (InviteException ex)
            {
                return(NotFound(ex.Message));
            }
        }