public async Task <ActionResult <PatResponse> > CreateTender([FromBody] PatRequest tenderRequest) { await Task.CompletedTask; // remove when async calls are added // Extract the tender from the request if (tenderRequest == null || tenderRequest.Tender == null) { log.LogError("TenderRequest.Tender==NULL in POST ~/api/tenders."); return(BadRequest()); } try { return(Created("", new PatResponse { Tender = tenderRepository.CreateTender(tenderRequest.Tender) })); } catch (InvalidRequestException ex) { log.LogError("InvalidRequestException in POST ~/api/tenders.", ex); return(BadRequest()); } catch (ResourceNotFoundException ex) { log.LogError("ResourceNotFoundException in POST ~/api/tenders.", ex); return(NotFound()); } }
public void CreateTender(Tender tender) { tender.QueueName = string.Join("", tender.Name.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries)) + "-queue"; tender.RoutingKey = Guid.NewGuid().ToString(); _tenderRepository.CreateTender(tender); }