public ActionResult <InvestigationToInvestigationDocumentDto> AttachDocument([FromBody] InvestigationToInvestigationDocumentDto dto)
 {
     try
     {
         if (dto is null)
         {
             return(BadRequest("attach can't be null"));
         }
         var document = new InvestigationToInvestigationDocumentMapper().ToModel(dto);
         var send     = _unitOfWork.InvestigationToInvestigationDocuments.Add(document);
         _unitOfWork.Save();
         var result = new InvestigationToInvestigationDocumentMapper().ToDto(send);
         return(CreatedAtAction(nameof(GetDocument), new { id = result.InvestigationToInvestigationDocumentId }, result));
     }
     catch (Exception e)
     {
         throw new HttpRequestException(e.Message, e, HttpStatusCode.InternalServerError);
     }
 }
예제 #2
0
 public async Task <InvestigationToInvestigationDocumentDto> AttachDocumentAsync(InvestigationToInvestigationDocumentDto document)
 {
     return(await new HttpRequestService <InvestigationToInvestigationDocumentDto>().CreateAsync(document, _documentUrl, Api));
 }