RestAPI merging + views changes.

This commit is contained in:
Yuee Shiness 2023-05-13 22:46:33 +04:00
commit c5603b1ceb

View File

@ -1,5 +1,6 @@
using ComputerStoreContracts.BindingModels; using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.BusinessLogicContracts; using ComputerStoreContracts.BusinessLogicContracts;
using ComputerStoreContracts.SearchModels;
using ComputerStoreContracts.ViewModels; using ComputerStoreContracts.ViewModels;
using Microsoft.AspNetCore.Mvc; 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}")] [HttpDelete("{id}")]
public bool DeleteComponent(int id) public bool DeleteComponent(int id)
{ {