Пример #1
0
        public ActionResult Create(Group group)
        {
            if (ModelState.IsValid)
            {
                db.Groups.Add(group);
                db.SaveChanges();
                return RedirectToAction("Index", "Faculty", new { id = group.FacultyID, groupID = group.GroupID });
            }

            ViewBag.FacultyID = new SelectList(db.Faculties, "FacultyID", "Name", group.FacultyID);
            return View(group);
        }
Пример #2
0
 public ActionResult Edit(Group group)
 {
     if (ModelState.IsValid)
     {
         db.Entry(group).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index", "Faculty", new { id = group.FacultyID, groupID = group.GroupID });
     }
     ViewBag.FacultyID = new SelectList(db.Faculties, "FacultyID", "Name", group.FacultyID);
     return View(group);
 }