public ActionResult Create([Bind(Include = "Id,IdUsers,IdDossier,IdExercice")] PreferencesPivot pero) { if (pero != null) { if (pero.Id > 0) { pero.IdUsers = Constantes.IdentifiantUser; pero.IdDossier = Constantes.IdentifiantDossier; pero.IdExercices = 2; preferencesServise.UpdatePreferencesPivot(pero); preferencesServise.SavePreferencesPivot(); } else { pero.IdUsers = Constantes.IdentifiantUser; pero.IdDossier = Constantes.IdentifiantDossier; pero.IdExercices = 2; preferencesServise.CreatePreferencesPivot(pero); preferencesServise.SavePreferencesPivot(); } return(RedirectToAction("Index")); } PreferencesFormViewModel per = Mapper.Map <PreferencesPivot, PreferencesFormViewModel>(pero); return(View(per)); }