26 lines
586 B
C#
26 lines
586 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using ServiceManager.API.Models;
|
|
|
|
namespace ServiceManager.API.Services
|
|
{
|
|
public interface IArticlesService
|
|
{
|
|
Task<IEnumerable<Article>> GetArticlesAsync();
|
|
}
|
|
|
|
public class ArticlesService : IArticlesService
|
|
{
|
|
private readonly AppDbContext _context;
|
|
|
|
public ArticlesService(AppDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<IEnumerable<Article>> GetArticlesAsync()
|
|
{
|
|
return await _context.Articles.ToListAsync();
|
|
}
|
|
}
|
|
}
|