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,38 @@
namespace MyOffice.Data.Repositories.Account;
using Microsoft.EntityFrameworkCore;
using Models.Accounts;
using MyOffice.Data.Repositories;
public class AccountCategoryRepository : AppRepository<AccountCategory>, IAccountCategoryRepository
{
public List<AccountCategory> GetAll(Guid userId)
{
return _context.AccountCategories
.Include(x => x.Accounts)
.Where(x => x.UserId == userId)
.ToList();
}
public bool Add(AccountCategory accountCategory)
{
return AddBase(accountCategory) > 0;
}
public AccountCategory? Get(Guid userId, Guid id)
{
return _context.AccountCategories
.Include(x => x.Accounts)
.FirstOrDefault(x => x.Id == id && x.UserId == userId);
}
public bool Update(AccountCategory accountCategory)
{
return UpdateBase(accountCategory) > 0;
}
public bool Remove(AccountCategory accountCategory)
{
return RemoveBase(accountCategory) > 0;
}
}