fix
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
namespace MyOffice.Data.Repositories.Currency;
|
||||
|
||||
using Models.Currencies;
|
||||
|
||||
public class CurrencyRateRepository : AppRepository<CurrencyRate>, ICurrencyRateRepository
|
||||
{
|
||||
public List<CurrencyRate> GetLastRates(Guid currencyId, int count = 1)
|
||||
{
|
||||
return _context.CurrencyRates
|
||||
.Where(x => x.CurrencyId == currencyId)
|
||||
.OrderByDescending(x => x.DateTime)
|
||||
.ThenByDescending(x => x.Id)
|
||||
.Take(count)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public bool AddRate(CurrencyRate currencyRate)
|
||||
{
|
||||
return this.AddBase(currencyRate) > 0;
|
||||
}
|
||||
|
||||
public List<CurrencyRate> GetAtDate(Guid currencyId, DateTime date)
|
||||
{
|
||||
return _context.CurrencyRates
|
||||
.Where(x => x.CurrencyId == currencyId && x.DateTime == date)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user