Esempio n. 1
0
        public ActionResult Create(FacultCreate facult)
        {
            if (ModelState.IsValid)
            {
                _db.Facults.Add(facult);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(facult);
        }
Esempio n. 2
0
        public ActionResult Create(FacultCreate model)
        {
            if (ModelState.IsValid)
            {
                _db.Facults.Add(model);
                _db.SaveChanges();

                if (!Roles.RoleExists(model.FacultInstance.FacultId.ToString(CultureInfo.InvariantCulture)))
                    Roles.CreateRole(model.FacultInstance.FacultId.ToString(CultureInfo.InvariantCulture));

                return RedirectToAction("Index");
            }

            return View(model);
        }