public IActionResult GetPaymentsOfDealer([FromRoute] int?id = null, [FromRoute] int?secondPartyId = null, [FromQuery] int page = 1, [FromQuery] int perPage = 10, [FromQuery] string sort = "payDate asc", [FromQuery] string filter = "") { id = id ?? 1; var paymentsQuery = PaymentResult.Where(u => u.PayeeId == id || u.PayerId == id); if (secondPartyId != null) { paymentsQuery = paymentsQuery.Where(u => u.PayeeId == secondPartyId || u.PayerId == secondPartyId); } var payments = paymentsQuery.OrderBy(sort).PageResult(page, perPage); return(Ok(payments)); }
public IActionResult GetExpensesOfDealer([FromRoute] int id, [FromQuery] int page = 1, [FromQuery] int perPage = 10, [FromQuery] string sort = "id desc", [FromQuery] string filter = "") { var payments = PaymentResult.Where(u => u.PayerId == id).OrderBy(u => u.PayDate).PageResult(page, perPage); return(Ok(payments)); }