There is one registration form with two types of clients, a legal entity and an individual. The question is how to delimit them. So far there is such a code where sending 1 Form C # works

public async Task<IActionResult> Create([Bind("Email,EmailPersо...")] CreateClientCommand command) { if (ModelState.IsValid) { var creat = Mediator.Send(new CreateClientCommand() { Email = command.Email, Type = command.Type, EmailPerso = command.EmailPerso, Country = command.Country, Adress = command.Adress, }).Result; return RedirectToAction(nameof(Index)); } return View(command); } 

HTML

 <form asp-action="Create"> ... <div class="col-md-4 col-md-offset-1"><button class="btn btn-default" type="submit" value="Create"> VALIDER</button></div> </form> 

The problem is how to do it in one form?

  • If you have 2 different actions, then probably these should be 2 different forms. - tym32167
  • Or add a radio button or checkbox, according to which you will determine to which type (CreateLegalEntity, CreatePerson) the created object belongs and bring it to the desired type. - XelaNimed

0