fix
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user