Beispiel #1
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(employee);
 }
Beispiel #2
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(employee);
        }
Beispiel #3
0
 public ActionResult Index()
 {
     Employee employee = new Employee
     {
         Name = "张三",
         Gender = "M",//男
         Education = "M",//硕士
         Departments = new string[] { "HR", "AD" },//人事部,行政部
         Skills = new string[] { "CSharp", "AdoNet" }//C#,ADO.NET
     };
     return View(employee);
 }
Beispiel #4
0
 public ActionResult Index()
 {
     Employee employee = new Employee { Name = "张三", Department = "IT", IsPartTime = true };
     return View(employee);
 }
Beispiel #5
0
 public ActionResult Index(Employee employee)
 {
     return View(employee);
 }