Example #1
0
        public JsonResult Courses(int department = 0)
        {
            Department d;

            if (department == 0)
            {
                d = _departmetmentsProvider.GetAllDepartments().First();
            }
            else
            {
                d = _departmetmentsProvider.GetDepartment(department);
            }

            var courses = d.Courses.Select(n => new { Text = n.Name, Value = n.Id });

            return(Json(courses, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index()
        {
            var curremUser       = _employeesProvider.GetEmployee(User.Identity.Name);
            int userDepartmentId = curremUser.Course.Department.Id;

            ViewBag.IsRoot = curremUser.Root;

            IEnumerable <int> ids = null;

            if (curremUser.Root)
            {
                ids = _departmentsProvider.GetAllDepartments().Select(n => n.Id);
            }
            else
            {
                ids = _departmentsProvider.GetAllDepartments().Where(n => n.Id == userDepartmentId).Select(n => n.Id);
            }

            return(View(ids));
        }