I am trying to figure out the proper way to model and validate a form with multiple form tags and multiple submit buttons using ASP.Net Core 2. What I have is a form where a use
I would break my models into two class and then use a ViewModel instead:
public class SignIn
{
[Required]
public string Username { get; set; }
[Required]
public string Password { get; set; }
}
public class SignUp
{
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
[Required]
public string CellNumber { get; set; }
}
public class LandingViewModel
{
public SignIn SignIn { get; set; }
public SignUp SignUp { get; set; }
}
Then:
@model MyApp.ViewModels.LandingViewModel
SignIn.Username, SignIn.Password, SignUp.FirstName,...