public ActionResult Create(EMS_Person eMS_Person) { if (ModelState.IsValid) { db.EMS_Person.Add(eMS_Person); db.SaveChanges(); return(RedirectToAction("Create", "EMS_FullTimeEmployee", eMS_Person)); } return(View(eMS_Person)); }
public ActionResult Create(EMS_FullTimeEmployee eMS_FullTimeEmployee) { if (ModelState.IsValid) { db.EMS_Fulltime.Add(eMS_FullTimeEmployee); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Company_ID = new SelectList(db.EMS_Company, "Company_ID", "CompanyDescription", eMS_FullTimeEmployee.Company_ID); ViewBag.Person_ID = new SelectList(db.EMS_Person, "Person_ID", "First_Name", eMS_FullTimeEmployee.Person_ID); return(View(eMS_FullTimeEmployee)); }
public ActionResult CreateUser(EMS_User u) { // replace SecurityLevel_ID to ScurityDescription. ViewBag.SecurityLevel_ID = new SelectList(db.EMS_SecurityLevel, "SecurityLevel_ID", "ScurityDescription"); // is model state. if (ModelState.IsValid) { // add new user into database. db.EMS_Users.Add(u); // save change. db.SaveChanges(); return(RedirectToAction("LogIn", "LogIn")); } // return view layer. return(View("Index")); }