I am developing an app to start, you must ask the user some data to auenticarse (username and password) but on different screens, since it is a totem (without keyboard or mouse) and on each screen displays a virtual keyboard , which is alphabetic for the user, and numeric for the password.
Well, in that context, I have a MVC C # controller, which has an index, which is the presentation screen, and then 2 more views, one for the user, and another for the password. In summary, this works well, since in each screen I rescue the data (user and password) and I pass them to a defined model in the following way:
public class Usuario
{
public Usuario()
{ }
[Display(Name = "Nombre Usuario")]
public string UserName { get; set; }
[Display(Name = "Password")]
public string Password { get; set; }
}
The problem is that when going to the authentication process (defined in a business layer), the variable UserName is lost after I rescue the password.
here is the controller that I have implemented:
public class HomeController : Controller
{
private Usuario usuario = new Usuario();
public ActionResult Index() // pantalla de inicio
{
return View();
}
public ActionResult IngresaUsuario()
{
return View();
}
public ActionResult IngresaPassword()
{
usuario.UserName = Request.Form["_usuario"];
return View();
}
public ActionResult EvaluaAutenticacion()
{
usuario.Password = Request.Form["_password"];
return RedirectToAction("SeleccionaPacientes");
}
in the actionReslt EvaluaAutenticacion, I only have the password as data, since the user was null
The question is: how should I declare the user variable? , because even if you declare it as public, you still lose the value of the user.
Greetings