Good evening, I tried to look in other posts and I did not find the answer. I have a Controller in my Asp Net MVC project that has this condition:
if (resultado == null)
{
ModelState.AddModelError("", "Usuário ou senha inválidos");
return RedirectToAction("Index", "Nav");
}
else
{
if (produto != null)
{
carrinho.AdicionarItem(prod, quantidade);
}
return RedirectToAction("Index", "Nav");
}
}
I have tried in several ways to put a message in case the condition is in the IF to display an alert message to the user, but I can not. I got to try with TempData but it displayed only written, I wanted an Alert or Pop Up Alert. I tried last with ModelState and put @ Html.ValidationSummary () in the view, but it also did not display Pop-Up. I tried with FlashMessage and I could not. Can someone please help me?