Beispiel #1
0
        public ActionResult SelectRole()
        {
            SelectRoleViewModel model = new SelectRoleViewModel();

            model.Roles = roleService.GetRoles().Where(e => e.Name != "Admin");

            return(View(model));
        }
Beispiel #2
0
        public ActionResult SelectRole(SelectRoleViewModel model)
        {
            if (model.SelectedRoleId == 1)
            {
                return(RedirectToAction("RegisterStudent", "Register"));
            }

            return(RedirectToAction("RegisterCompany", "Register"));
        }
Beispiel #3
0
        public ActionResult SelectRole(SelectRoleViewModel userInput)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            var roleStore             = new RoleStore <IdentityRole>(context);
            var roleManager           = new RoleManager <IdentityRole>(roleStore);
            CreateUserViewModel model = new CreateUserViewModel();

            IgnisModel db = new IgnisModel();

            if (userInput.RoleId == Guid.Parse(roleManager.FindByName("admin").Id))
            {
                model.UserType = "admin";
            }
            else if (userInput.RoleId == Guid.Parse(roleManager.FindByName("ig").Id))
            {
                model.UserType = "ig";
            }
            else if (userInput.RoleId == Guid.Parse(roleManager.FindByName("cfo").Id))
            {
                model.UserType           = "cfo";
                ViewBag.InfrastructureId = new SelectList(db.FireStations, "Id", "Name");
            }
            else if (userInput.RoleId == Guid.Parse(roleManager.FindByName("dfo").Id))
            {
                model.UserType           = "dfo";
                ViewBag.InfrastructureId = new SelectList(db.Districts, "Id", "Name");
            }
            else if (userInput.RoleId == Guid.Parse(roleManager.FindByName("rfo").Id))
            {
                model.UserType           = "rfo";
                ViewBag.InfrastructureId = new SelectList(db.Ranges, "Id", "Name");
            }
            else if (userInput.RoleId == Guid.Parse(roleManager.FindByName("zfo").Id))
            {
                model.UserType           = "zfo";
                ViewBag.InfrastructureId = new SelectList(db.Zones, "Id", "Name");
            }


            return(View("CreateUser", model));
        }