public async Task <ActionResult <IEnumerable <PlaceProvider> > > OrderRegistrations( [FromForm] string placeProviderId, [FromForm] int registrations, [FromForm] string currency ) { try { if (!currency.ValidateCurrency()) { throw new Exception("Invalid currency"); } if (registrations < 0) { throw new Exception("Invalid registrations"); } if (!User.IsAuthorizedToIssueInvoice(userRepository, placeProviderRepository, placeProviderId)) { throw new Exception("You are not authorized to issue invoices for this company. Please contact administrator or accountant."); } return(Ok(placeProviderRepository.IssueProformaInvoiceRegistrations(placeProviderId, registrations, currency))); } catch (Exception exc) { logger.LogError(exc, exc.Message); return(BadRequest(new ProblemDetails() { Detail = exc.Message })); } }