public async Task <ToolType> getToolType(int toolTypeId) { var toolType = await _context.ToolTypes .Where(x => x.toolTypeId == toolTypeId) .FirstOrDefaultAsync(); if (toolType.thingGroupIds != null && toolType.thingGroupIds.Length != 0) { var(group, status) = await _thingGroupService.getGroupsList(toolType.thingGroupIds); if (status == HttpStatusCode.OK) { toolType.thingGroups = new List <ThingGroup> (group); } } return(toolType); }
public async Task <ProductionOrderType> getProductionOrderType(int productionOrderTypeId) { var productionOrderType = await _context.ProductionOrderTypes .Where(x => x.productionOrderTypeId == productionOrderTypeId) .Include(x => x.stateConfiguration) .ThenInclude(x => x.states) .FirstOrDefaultAsync(); if (productionOrderType.thingGroupIds != null && productionOrderType.thingGroupIds.Length != 0) { var(group, status) = await _thingGroupService.getGroupsList(productionOrderType.thingGroupIds); if (status == HttpStatusCode.OK) { productionOrderType.thingGroups = group; } } return(productionOrderType); }