Poszukiwacz/Serwer/Serwer.Api/Controllers/HistoryController.cs

29 lines
756 B
C#
Raw Permalink Normal View History

2021-01-09 14:44:14 +01:00
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Serwer.Infrastructure.Services;
using System;
using System.Threading.Tasks;
namespace Serwer.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class HistoryController: ControllerBase
{
private readonly IHistoryService _historyService;
public HistoryController(IHistoryService historyService)
{
_historyService = historyService;
}
[Authorize]
[HttpGet()]
public async Task<IActionResult> Get()
{
var id = User.Identity.Name;
var history = await _historyService.GetAsync(Guid.Parse(id));
return Ok(history);
}
}
}