Publish from private repository

This commit is contained in:
Gitea Actions
2026-08-01 12:08:49 +00:00
commit 6f7fd61ee9
695 changed files with 69563 additions and 0 deletions
@@ -0,0 +1,72 @@
namespace MyOffice.Data.Repositories.Item;
using Microsoft.EntityFrameworkCore;
using MyOffice.Data.Models.Items;
using MyOffice.DbContext;
public class ItemCategoryRepository : AppRepository<ItemCategory>, IItemCategoryRepository
{
public ItemCategoryRepository(AppDbContext context) : base(context)
{
}
public List<ItemCategory> GetAll(Guid userId)
{
return _context.ItemCategories
.Include(x => x.Items)
.Where(x => x.UserId == userId)
.ToList();
}
public async Task<List<ItemCategory>> GetAllAsync(Guid userId, CancellationToken cancellationToken = default)
{
return await _context.ItemCategories
.Include(x => x.Items)
.Where(x => x.UserId == userId)
.ToListAsync(cancellationToken);
}
public bool Add(ItemCategory itemCategory)
{
return AddBase(itemCategory) > 0;
}
public async Task<bool> AddAsync(ItemCategory itemCategory, CancellationToken cancellationToken = default)
{
return await AddBaseAsync(itemCategory, cancellationToken) > 0;
}
public ItemCategory? Get(Guid userId, Guid id)
{
return _context.ItemCategories
.Include(x => x.Items)
.FirstOrDefault(x => x.Id == id && x.UserId == userId);
}
public async Task<ItemCategory?> GetAsync(Guid userId, Guid id, CancellationToken cancellationToken = default)
{
return await _context.ItemCategories
.Include(x => x.Items)
.FirstOrDefaultAsync(x => x.Id == id && x.UserId == userId, cancellationToken);
}
public bool Update(ItemCategory itemCategory)
{
return UpdateBase(itemCategory) > 0;
}
public async Task<bool> UpdateAsync(ItemCategory itemCategory, CancellationToken cancellationToken = default)
{
return await UpdateBaseAsync(itemCategory, cancellationToken) > 0;
}
public bool Remove(ItemCategory itemCategory)
{
return RemoveBase(itemCategory) > 0;
}
public async Task<bool> RemoveAsync(ItemCategory itemCategory, CancellationToken cancellationToken = default)
{
return await RemoveBaseAsync(itemCategory, cancellationToken) > 0;
}
}