public ActionResult Create(StudGroup studgroup)
        {
            if (ModelState.IsValid)
            {
                _db.Groups.Add(studgroup);
                _db.SaveChanges();
                return RedirectToAction("Index", new { controller = "Facult" });
            }

            ViewBag.FacultId = new SelectList(_db.Facults.ListNames(), "FacultId", "Name", studgroup.FacultId);
            return View(studgroup);
        }
Beispiel #2
0
        public ActionResult Create(StudGroup studgroup)
        {
            if (ModelState.IsValid)
            {
                if (!Roles.IsUserInRole(studgroup.FacultId.ToString(CultureInfo.InvariantCulture)) && !Roles.IsUserInRole(StaticData.AdminRoleName))
                    return RedirectToRoute(new { controller = "Default", action = "Error", id = 404 });

                _db.Groups.Add(studgroup);
                _db.SaveChanges();
                return RedirectToAction("Index", new { controller = "Facult" });
            }

            ViewBag.FacultId = new SelectList(_db.Facults.ListNames(), "FacultId", "Name", studgroup.FacultId);
            return View(studgroup);
        }