22 lines
642 B
C#
22 lines
642 B
C#
|
|
using Apimanager_backend.Data;
|
|
using Apimanager_backend.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Apimanager_backend.Services
|
|
{
|
|
public class UserPackageService : IUserPackageService
|
|
{
|
|
private ApiContext _context;
|
|
public UserPackageService(ApiContext apiContext)
|
|
{
|
|
_context = apiContext;
|
|
}
|
|
public async Task<List<UserPackage>> GetUserPackagesByUserIdAsync(int userId)
|
|
{
|
|
IQueryable<UserPackage> query = _context.UserPackages.Include(x => x.Package).Where(x => x.UserId == userId);
|
|
return await query.ToListAsync();
|
|
}
|
|
}
|
|
}
|