27 lines
726 B
C#
27 lines
726 B
C#
using Microsoft.AspNetCore.Http.HttpResults;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ServiceManager.API.Models;
|
|
using ServiceManager.API.Services;
|
|
|
|
namespace ServiceManager.API.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class ArticlesController : ControllerBase
|
|
{
|
|
private readonly IArticlesService _articlesService;
|
|
|
|
public ArticlesController(IArticlesService articlesService)
|
|
{
|
|
_articlesService = articlesService;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<ActionResult<IEnumerable<Article>>> GetArticles()
|
|
{
|
|
var articles = await _articlesService.GetArticlesAsync();
|
|
return Ok(articles);
|
|
}
|
|
}
|
|
}
|