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,41 @@
namespace MyOffice.Data.Repositories.Currency;
using Microsoft.EntityFrameworkCore;
using Models.Currencies;
using MyOffice.Data.Repositories;
public class CurrencyRepository : AppRepository<Currency>, ICurrencyRepository
{
public List<Currency> GetAll(Guid userId)
{
return _context.Currencies
.Include(x => x.CurrencyGlobal)
.Where(x => x.UserId == userId)
.ToList();
}
public Currency? Get(Guid userId, Guid id)
{
return _context.Currencies.FirstOrDefault(x => x.Id == id && x.UserId == userId);
}
public Currency? GetByGlobalCurrency(Guid userId, string globalCurrencyId)
{
return _context.Currencies.FirstOrDefault(x => x.UserId == userId && x.CurrencyGlobalId == globalCurrencyId);
}
public bool Add(Currency currency)
{
return AddBase(currency) > 0;
}
public bool Update(Currency currency)
{
return UpdateBase(currency) > 0;
}
public bool Remove(Currency currency)
{
return RemoveBase(currency) > 0;
}
}