Example #1
0
        public IActionResult Get([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var departmentViewModel = _departmentRepository.GetViewModel(id).Result;

            departmentViewModel.Organization               = _organizationRepository.GetViewModel(departmentViewModel.OrganizationId).Result;
            departmentViewModel.Entities                   = _entityRepository.GetViewModelsInDepartment(departmentViewModel.DepartmentId, _componentRepository, _flightLogRepository).Result;
            departmentViewModel.ArchivedComponents         = _componentRepository.AllArchivedInDepartment(departmentViewModel.DepartmentId).Result;
            departmentViewModel.DepartmentApplicationUsers = _departmentApplicationUserRepository.GetViewModelsInDepartment(departmentViewModel.DepartmentId).Result;


            return(Ok(departmentViewModel));
        }