fix
This commit is contained in:
@@ -43,11 +43,29 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
{
|
||||
Account = x,
|
||||
TotalPlus = x.Motions!.Sum(m => m.AmountPlus),
|
||||
TotalMinus = x.Motions!.Sum(m => m.AmountPlus),
|
||||
TotalMinus = x.Motions!.Sum(m => m.AmountMinus),
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public AccountDetailed? GetByIdDetailed(Guid userId, Guid id)
|
||||
{
|
||||
return _context.Accounts!
|
||||
.Include(x => x.CurrencyGlobal)
|
||||
.Include(x => x.Categories)!
|
||||
.ThenInclude(x => x.Category)
|
||||
.Include(x => x.AccessRights)!
|
||||
.ThenInclude(x => x.User)
|
||||
.Where(x => x.Id == id && x.AccessRights!.Any(a => a.UserId == userId))
|
||||
.Select(x => new AccountDetailed
|
||||
{
|
||||
Account = x,
|
||||
TotalPlus = x.Motions!.Sum(m => m.AmountPlus),
|
||||
TotalMinus = x.Motions!.Sum(m => m.AmountMinus),
|
||||
})
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool Add(Account account)
|
||||
{
|
||||
return AddBase(account) > 0;
|
||||
|
||||
Reference in New Issue
Block a user