Files
myoffice/MyOffice.Data.Repositories/Account/AccountAccountCategoryRepository.cs
2023-07-31 08:50:05 +03:00

26 lines
784 B
C#

namespace MyOffice.Data.Repositories.Account;
using Microsoft.EntityFrameworkCore;
using Models.Accounts;
public class AccountAccountCategoryRepository : AppRepository<AccountAccountCategory>, IAccountAccountCategoryRepository
{
public List<AccountAccountCategory> Get(Guid userId, Guid accountId, Guid categoryId)
{
return _context.AccountAccountCategories
.Include(x => x.Account)
.Include(x => x.Category)
.Where(x => x.AccountId == accountId && x.CategoryId == categoryId && x.Category.UserId == userId)
.ToList();
}
public bool Remove(AccountAccountCategory accountAccountCategory)
{
return RemoveBase(accountAccountCategory) > 0;
}
public bool Add(AccountAccountCategory accountAccountCategory)
{
return AddBase(accountAccountCategory) > 0;
}
}