Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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"));
        }