public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            //returnUrl = returnUrl ?? Url.Content("~/");
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            if (ModelState.IsValid)
            {
                List <Booking> booking = new List <Booking>();
                booking.Add(new Booking());
                booking.Add(new Booking());
                List <ServiceRequest> serviceRequests = new List <ServiceRequest>();
                serviceRequests.Add(new ServiceRequest());
                List <Complaint> Complaint = new List <Complaint>();
                Complaint.Add(new Complaint());
                Random r     = new Random();
                string ran   = r.Next(10000, 99999).ToString();
                var    users = await _classRepository.FindByConnectionIdAsync(ran);

                while (users != null)
                {
                    ran = r.Next(10000, 99999).ToString();
                }


                var user = new ApplicationUser
                {
                    UserName      = Input.Email,
                    Email         = Input.Email,
                    IsAdmin       = Input.IsAdmin,
                    IsDeliveryBoy = Input.IsDeliveryBoy,
                    Name          = Input.Name,
                    MobileNo      = Input.MobileNo,
                    AadharNo      = Input.AadharNo,
                    AccountNo     = Input.AccountNo,
                    IFSC          = Input.IFSC,
                    Address       = Input.Address,
                    Pincode       = Input.Pincode,
                    Connection_Id = ran,

                    //Bookings=booking,

                    //ServiceRequests=serviceRequests,
                    //Complaints=Complaint
                };

                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    if (user.IsAdmin)
                    {
                        await AddToRoleAdmin(user);

                        _logger.LogInformation("User added to admin group");
                    }
                    if (user.IsDeliveryBoy)
                    {
                        await AddToRoleDeliveryBoy(user);

                        _logger.LogInformation("User added to admin group");
                    }


                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                    var callbackUrl = Url.Page(
                        "/Account/ConfirmEmail",
                        pageHandler: null,
                        values: new { area = "Identity", userId = user.UserName, code = code, returnUrl = returnUrl },
                        protocol: Request.Scheme);

                    _classRepository.SendMailForPaper(Input.Email, "Confirm your email",
                                                      $"Please confirm your account by <a href='{callbackUrl}'>clicking here</a>.");

                    if (_userManager.Options.SignIn.RequireConfirmedAccount)
                    {
                        return(RedirectToPage("RegisterConfirmation", new { email = Input.Email, returnUrl = returnUrl }));
                    }
                    else
                    {
                        await _signInManager.SignInAsync(user, isPersistent : false);

                        return(LocalRedirect(returnUrl));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }