Beispiel #1
0
        public ActionResult Create(Major major)
        {
            if (ModelState.IsValid)
            {
                Db.Majors.Add(major);
                Db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(major);
        }
Beispiel #2
0
 public ActionResult Edit(Major major)
 {
     if (ModelState.IsValid)
     {
         Db.Entry(major).State = EntityState.Modified;
         Db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(major);
 }
Beispiel #3
0
 public ActionResult GetMajorByDepartmentAndAll(string department)
 {
     var list = Db.Majors.Where(u => u.Department.Name == department).ToList();
     var all = new Major() { Abbreviation = "全部", Id = 0, IsStop = 0, Name = "全部" };
     list.Insert(0, all);
     return Json(list);
 }