public ComponentTypeModel GetComponentTypeModel(int?Id = null, int assetTypeId = -1, int?assetCategoryId = -1) { if (Id.HasValue) { ComponentType componentType = _componentTypeRepository.GetComponentTypeByID(Id.Value); if (componentType != null) { return(new ComponentTypeModel { ID = componentType.ID, Name = componentType.Name, IsActive = componentType.IsActive, AssetTypeID = componentType.AssetTypeID, AssetTypes = _assetTypeService.GetDropdownAssetTypes(null, componentType.AssetTypeID), AssetCategoryID = componentType.AssetCategoryId, AssetCategories = _assetCategoryService.GetDropdownAssetCategories(componentType.AssetCategoryId) }); } else { throw new EntryPointNotFoundException(); } } else { return(new ComponentTypeModel { AssetTypes = _assetTypeService.GetDropdownAssetTypes(assetCategoryId, assetTypeId), AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetCategoryId.Value) }); } }
public AssetTypeModel GetAssetTypeModel(int?Id = null, int assetCategoryID = -1) { if (Id.HasValue) { AssetTypes assetType = _assetAssetTypeRepository.GetAssetTypeByID(Id.Value); if (assetType != null) { return(new AssetTypeModel { ID = assetType.ID, Description = assetType.Description, AssetCategoryID = assetType.AssetCategoryID, AssetCategoryName = assetType.AssetCategory.Description, AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetType.AssetCategoryID) }); } else { throw new EntryPointNotFoundException(); } } else { return(new AssetTypeModel { AssetCategories = _assetCategoryService.GetDropdownAssetCategories(assetCategoryID) }); } }