Files
myoffice/MyOffice.Data.Repositories/Account/AccountMotionRepository.cs
T
2023-06-21 17:56:00 +03:00

24 lines
681 B
C#

namespace MyOffice.Data.Repositories.Account;
using Microsoft.EntityFrameworkCore;
using Models.Accounts;
public class AccountMotionRepository : AppRepository<AccountMotion>, IAccountMotionRepository
{
public bool Add(AccountMotion accountMotion)
{
return AddBase(accountMotion) > 0;
}
public List<AccountMotion> GetByAccount(Guid accountId, DateTime dateFrom, DateTime dateTo)
{
return _context
.AccountMotions
.Include(x => x.Motion)
.ThenInclude(x => x.MotionGlobal)
.Where(x => x.AccountId == accountId && x.DateTime >= dateFrom && x.DateTime <= dateTo)
.OrderByDescending(x => x.DateTime)
.ThenByDescending(x => x.CreatedOn)
.ToList();
}
}