public ActionResult <InvestigationDocumentDto> CreateDocument([FromBody] InvestigationDocumentDto dto) { try { if (dto is null) { return(BadRequest("Round can't be null")); } var document = new InvestigationDocumentMapper().ToModel(dto); var result = _unitOfWork.InvestigationDocuments.Add(document); _unitOfWork.Save(); var send = new InvestigationDocumentMapper().ToDto(result); return(CreatedAtAction(nameof(GetDocumentById), new { id = send.InvestigationDocumentId }, send)); } catch (Exception e) { throw new HttpRequestException(e.Message, e, HttpStatusCode.InternalServerError); } }
public async Task <InvestigationDocumentDto> CreateDocumentAsync(InvestigationDocumentDto document) { return(await new HttpRequestService <InvestigationDocumentDto>().CreateAsync(document, BaseUrl, Api)); }