mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
738 B
23 lines
738 B
using System.Collections.Generic; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using LanguageExt; |
|
using Microsoft.EntityFrameworkCore; |
|
using static LanguageExt.Prelude; |
|
|
|
namespace ErsatzTV.Infrastructure.Data.Repositories |
|
{ |
|
public class ResolutionRepository : IResolutionRepository |
|
{ |
|
private readonly TvContext _dbContext; |
|
|
|
public ResolutionRepository(TvContext dbContext) => _dbContext = dbContext; |
|
|
|
public Task<Option<Resolution>> Get(int id) => |
|
_dbContext.Resolutions.SingleOrDefaultAsync(r => r.Id == id).Map(Optional); |
|
|
|
public Task<List<Resolution>> GetAll() => |
|
_dbContext.Resolutions.ToListAsync(); |
|
} |
|
}
|
|
|