Exemplo n.º 1
0
 public ExpenseDto GetExpenseById(GetExpenseByIdDto dto)
 {
     return(ctx.Expenses.
            Where(p => p.Id == dto.Id.ToGuid()).
            Include(p => p.Categories).ThenInclude(p => p.StoreCategory).
            Select(p => DtoBuilder.CreateExpenseDto(p)).
            FirstOrDefault());
 }
Exemplo n.º 2
0
 public List <ExpenseDto> GetExpensesByPage(GetExpensesByPageDto dto)
 {
     return(ctx.Expenses.
            Skip((dto.PageNo - 1) * AdminSettings.Block).
            Take(AdminSettings.Block).
            Where(p => dto.UserId == null || p.UserId == dto.UserId).
            Include(p => p.Categories).ThenInclude(p => p.StoreCategory).
            Select(p => DtoBuilder.CreateExpenseDto(p)).
            ToList());
 }