Ejemplo n.º 1
0
        public ActionResult Create(Department department)
        {
            if (ModelState.IsValid)
            {
                Db.Departments.Add(department);
                Db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(department);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Department department)
 {
     if (ModelState.IsValid)
     {
         Db.Entry(department).State = EntityState.Modified;
         Db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(department);
 }
Ejemplo n.º 3
0
 public ActionResult GetDepartmentAndAll()
 {
     var list = Db.Departments.Where(u => u.Verify == 0).ToList();
     var all = new Department() { Abbreviation = "全部", Id = 0, IsStop = 0, Name = "全部", Verify = 0 };
     list.Insert(0, all);
     return Json(list);
 }