I want to create an asp.net core razor pages (not MVC) program with modal for some of it's functionalities like login, forgot password, etc. I created a razor page for login with bootstrap modal and a link for open modal in frontend and LoginViewModel and RegistrationServices in backend. How can I use this page to access login modal in all pages? Can I use Partial view? How? otherwise, what is the solution? This is _Login:
public class _LoginModel : PageModel
{
private readonly ICookieAuthenticationService _cookieAuthenticationService;
private readonly IUserRegistrationService _userRegistrationService;
private readonly IUserService _userService;
public _LoginModel(ICookieAuthenticationService cookieAuthenticationService,
IUserRegistrationService userRegistrationService,
IUserService userService)
{
_cookieAuthenticationService = cookieAuthenticationService;
_userRegistrationService = userRegistrationService;
_userService = userService;
}
[BindProperty]
public LoginViewModel LoginViewModel { get; set; }
[TempData]
public string ErrorMessage { get; set; }
...
}
I removed @page from _Login and inject services and use this for partial view:
<partial name="_Login" model="new _LoginModel(cookieAuthenticationService, userRegistrationService, userService, logService)" />
but post method does not work because of remove @page.