예제 #1
0
        public IActionResult Create()
        {
            if (HttpContext.Session.GetInt32("UserId") == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewData["Email"]       = HttpContext.Session.GetString("Email");
            ViewData["AccessPages"] = HttpContext.Session.GetString("AccessPages");
            var model = new UserModel();

            model.CollegeList = _companyService.GetCompanies().Select(d => new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem
            {
                Text  = d.CollegeName,
                Value = d.ID.ToString()
            }).ToList();
            model.DepartmentList = _departmentService.GetDepartments().Where(d => d.Status == true).Select(d => new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem
            {
                Text  = d.DepartmentName,
                Value = d.ID.ToString()
            }).ToList();

            model.RoleList = _roleAuthorService.GetRoleAuthors().Select(d => new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem
            {
                Text  = d.RoleName,
                Value = d.ID.ToString()
            }).ToList();
            return(View(model));
        }
        public IActionResult Index()
        {
            if (HttpContext.Session.GetInt32("UserId") == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewData["AccessPages"] = HttpContext.Session.GetString("AccessPages");
            var data = _collegeService.GetCompanies();

            return(View(data));
        }