RestAPI additions.
This commit is contained in:
parent
1ce0d8db0b
commit
247ffd3b74
@ -10,4 +10,8 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerStoreContracts\ComputerStoreContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using ComputerStoreContracts.BindingModels;
|
||||
using ComputerStoreContracts.BusinessLogicContracts;
|
||||
using ComputerStoreContracts.SearchModels;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@ -38,6 +39,20 @@ namespace ComputerStoreRestAPI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ComponentViewModel? GetComponent(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _componentLogic.ReadElement(new ComponentSearchModel { ID = id } );
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Receiving list of components error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public bool DeleteComponent(int id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user