This commit is contained in:
2023-06-17 14:16:09 +03:00
parent 62178f1f32
commit 7ae5d3bc81
180 changed files with 12932 additions and 192 deletions
@@ -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();
}
}