コード例 #1
0
        public async Task <IActionResult> GetInventoryObjectSystemsAndPartsPartialInspection(int id)
        {
            string apiUrl     = $"api/inventory/systems/byTypeId/{id}";
            var    httpClient = await _facilityManagementHttpClient.GetClient();

            var response = await httpClient.GetAsync(apiUrl).ConfigureAwait(false);

            if (response.IsSuccessStatusCode)
            {
                var responseAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                var compressorSystemsViewModel = new SystemsViewModel
                {
                    InventoryObjectTypeId = id,
                    Systems = JsonConvert.DeserializeObject <ICollection <InventoryObjectSystemDTO> >(responseAsString)
                };

                return(PartialView("_SystemsPartialInspection", compressorSystemsViewModel));
            }
            else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
                     response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
            {
                return(RedirectToAction("AccessDenied", "Authorization"));
            }

            throw new Exception($"A problem happened while calling the API: {response.ReasonPhrase}");
        }
コード例 #2
0
        public DebuggerMainWindowViewModel(IDockingTabManager docking,
                                           SystemsViewModel systemsVM, ComponetsViewModel componetsVM)
        {
            OpenSceneInWindow          = new WpfActionCommand(OnOpenSceneInWindow);
            ShowHideOctreeBoxesCommand = new WpfActionCommand(OnShowHideOctreeBoxes);
            Docking   = docking;
            Systems   = systemsVM;
            Componets = componetsVM;

            subscriber = new ViewportSubscriber(this);

            systemsVM.SetCurrentRenderUpdater(this);
            componetsVM.SetCurrentRenderUpdater(this);
        }