I have a problem with viewmodel, when I try to add new enregistrement to my database when I have view titly typed with my viewmodel I get DbEntityValidationErrors.
This is code using viewmodel :
[HttpPost]
public ActionResult Create(Annonce annonce)
{
/*
if (ModelState.IsValid)
{
*/
_userservice.addannonce(annonce);
return RedirectToAction("Index");
/*
}
return View(new AnnonceView(annonce));
* */
}
But when I use my entity domain Annonce directly on view, there is any problem. Help me please and sorry for my bad english