Example #1
0
        public async Task <ActionResult <ComponentDetails> > GetComponentDetails(int id)
        {
            var component = await _bll.Components.FindDetails(id);

            if (component == null)
            {
                return(NotFound(new ResponseMessage("Component with given id was not found!")));
            }

            var compatibleComponents = await _bll.Compatibilities.FindAllComponentCompatibilities(id);

            component.CompatibleWith = compatibleComponents;
            var componentSpecifications = await _bll.ComponentSpecifications.FindAllComponentSpecs(id);

            component.Specifications = componentSpecifications;
            var componentTests = await _bll.ComponentTests.FindAllComponentTests(id);

            component.Tests = componentTests;

            return(Ok(_componentMapper.MapToApiDetails(component)));
        }