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,37 @@
namespace MyOffice.Data.Repositories.Motion;
using Microsoft.EntityFrameworkCore;
using Models.Motions;
public class MotionCategoryRepository : AppRepository<MotionCategory>, IMotionCategoryRepository
{
public List<MotionCategory> GetAll(Guid userId)
{
return _context.MotionCategories
.Include(x => x.Motions)
.Where(x => x.UserId == userId)
.ToList();
}
public bool Add(MotionCategory motionCategory)
{
return AddBase(motionCategory) > 0;
}
public MotionCategory? Get(Guid userId, Guid id)
{
return _context.MotionCategories
.Include(x => x.Motions)
.FirstOrDefault(x => x.Id == id && x.UserId == userId);
}
public bool Update(MotionCategory motionCategory)
{
return UpdateBase(motionCategory) > 0;
}
public bool Remove(MotionCategory motionCategory)
{
return RemoveBase(motionCategory) > 0;
}
}