RestAPI additions.

This commit is contained in:
Yuee Shiness 2023-05-13 22:45:29 +04:00
parent 1ce0d8db0b
commit 247ffd3b74
2 changed files with 19 additions and 0 deletions

View File

@ -10,4 +10,8 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputerStoreContracts\ComputerStoreContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -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)
{