public async Task <ActionResult <User> > Get(int userId, bool includeInvoices) { if (userId <= 0) { return(UnprocessableEntity()); } UserRow userRow = await _usersStorage.GetUserByIdAsync(userId); if (userRow == null) { return(NotFound()); } User user = userRow.Convert(); user.Address = (await _usersStorage.GetAddressByUserIdAsync(userId)).Convert(); if (!includeInvoices) { return(user); } user.Invoices = (await _invoices.GetInvoicesByUserIdAsync(userId)).Convert(userId); return(user); }