1
Following the models of that question, when I pass the commands to write the form data to the database, before even copying Visual Studio, points out the following error:
"The best overloaded method match for [...] has some invalid Arguments"
Follow the examples of the controller (remembering that the view and viewmodel are in the linked question at the beginning)
Controller
public ActionResult Novo()
    {
        ViewBag.Nacionalidade = new SelectList(db.Util.Where(u => u.tipo == 14), "id", "nome");
        var candidato = new CandidatoViewModel();
        return View(candidato);
    }
    [HttpPost]
    public ActionResult Novo(CandidatoViewModel candidato)
    {
        if (ModelState.IsValid) 
        {         
            db.Candidato.Add(candidato); // erro esta aqui
            db.SaveChanges();
            return RedirectToAction("VerCandidato", new { id = candidato.id });            
        }
        ViewBag.Nacionalidade = new SelectList(db.Util.Where(u => u.tipo == 14), "id", "nome", candidato.id_nacionalidade);
        return View(candidato);
    }
On which line does this error occur?
– Leonel Sanches da Silva
The error in question occurs when you pass invalid parameters when calling a method for example.
– Pedro Camara Junior
Ta ali no codigo Cigano, commented "db.Candidato.Add(candidate)/error esta aqui"
– Matheus Silva
@Pedrocamarajunior But my Viewmodel and Model have exactly the same properties, except for the list I used in viewModel and the model has no... I still don’t understand very well how this mapping is done when you have multiple models, if you have articles/Docs for reference and studies would be of great help, without being those of codeproject...
– Matheus Silva