//Helpers
        public ActionResult GetJsonUsersFromClient(string client)
        {
            var departments = QueryUtility.GetDepartmentsFromClient(client, db);
            IEnumerable <ContractUser> users = Enumerable.Empty <ContractUser>();

            //users.Concat(new[] { manager.FindByName("Admin") });
            foreach (Department d in departments)
            {
                if (d.DepartmentName != null)
                {
                    IEnumerable <ContractUser> addUser = QueryUtility.GetUsersFromDepartment(d.DepartmentName, db).AsEnumerable <ContractUser>();
                    if (addUser.Any())
                    {
                        users = users.Concat(addUser);
                    }
                }
            }
            //IQueryable<ContractUser> test = QueryUtility.GetUsersFromDepartment(departments.FirstOrDefault().DepartmentName, db);
            List <SelectListItem> data = new SelectList(users, "Id", "UserName").ToList();

            return(Json(data));
        }
Exemple #2
0
        public ActionResult GetJsonUsersFromDepartment(string department)
        {
            var data = new SelectList(QueryUtility.GetUsersFromDepartment(department, db), "Id", "UserName").ToList();

            return(Json(data));
        }