mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-24 13:32:22 +00:00
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System.Threading.Tasks;
|
|
using MalwareMultiScan.Api.Data.Models;
|
|
using MalwareMultiScan.Api.Services.Interfaces;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace MalwareMultiScan.Api.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Scan results controller.
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("api/results")]
|
|
[Produces("application/json")]
|
|
public class ScanResultsController : Controller
|
|
{
|
|
private readonly IScanResultService _scanResultService;
|
|
|
|
/// <summary>
|
|
/// Initialize scan results controller.
|
|
/// </summary>
|
|
/// <param name="scanResultService">Scan result service.</param>
|
|
public ScanResultsController(IScanResultService scanResultService)
|
|
{
|
|
_scanResultService = scanResultService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get scan result by id.
|
|
/// </summary>
|
|
/// <param name="id">Scan result id.</param>
|
|
[HttpGet("{id}")]
|
|
[ProducesResponseType(typeof(ScanResult), StatusCodes.Status200OK)]
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
public async Task<IActionResult> Index(string id)
|
|
{
|
|
var scanResult = await _scanResultService.GetScanResult(id);
|
|
|
|
if (scanResult == null)
|
|
return NotFound();
|
|
|
|
return Ok(scanResult);
|
|
}
|
|
}
|
|
} |