コード例 #1
0
        public ActionResult Create_Post()
        {
            if (ModelState.IsValid)
            {
                Employee employee = new Employee();
                UpdateModel<Employee>(employee);
                EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer();
                employeeBusinessLayer.AddEmployee(employee);

                return RedirectToAction("Index");
            }
            return View();
        }
コード例 #2
0
        public ActionResult Create(FormCollection fc)
        {
            Employee employee = new Employee();

            employee.Name = fc["Name"];
            employee.Gender = fc["Gender"];
            employee.City = fc["City"];
            employee.DateOfBirth = Convert.ToDateTime(fc["DateOfBirth"]);

            EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer();

            employeeBusinessLayer.AddEmployee(employee);
            return RedirectToAction("Index");
        }