I have a web API (ASP.net) and I want to have 2 clients (Xamarin and ASP.net MVC).
My web API works, I tested it with Postman. I tried to add a new user with the web client by consuming the WebAPI and it works. But now I want to check if email already exists in the database when the user enters his email in the form.
I saw that it's possible to use a RemoteAttribute to do this but this solution does not work for me.
I can check in the API if the email exists.
[AllowAnonymous]
[HttpGet]
public async Task<JsonResult<bool>> VerifyEmailAsync(string email)
{
var user = await UserManager.FindByEmailAsync(email);
if (user == null)
{
return Json(false);
}
else
{
return Json(true);
}
}
I can retrieve true or false but I don't know how I can consume this in my MVC client.
I hope you understand my problem.