public ActionResult Create([Bind(Exclude = "Id_E")] employe employeToCreate, Authentification adminToCreate)
{
// Validation logic
//ValidateContact(employeToCreate);
if (!ModelState.IsValid)
return View();
// Database logic
try
{
dcContact = new ContactDataContext();
dcContact.employes.InsertOnSubmit(employeToCreate);
dcContact.SubmitChanges();
if (employeToCreate.status == "Admin")
{
dcContact.Authentifications.InsertOnSubmit(adminToCreate);
dcContact.SubmitChanges();
//return RedirectToAction("Index");
}
//_entities.AddToemploye(employeToCreate);
//_entities.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Partager