예제 #1
0
 public ActionResult <RoundToInvestigationDocument> AttachDocument([FromBody] RoundToInvestigationDocumentDto dto)
 {
     try
     {
         if (dto is null)
         {
             return(BadRequest("Round can't be null"));
         }
         var roundToInvestigationDocument = new RoundToInvestigationDocumentMapper().ToModel(dto);
         var result = _unitOfWork.RoundToInvestigationDocuments.Add(roundToInvestigationDocument);
         _unitOfWork.Save();
         var send = new RoundToInvestigationDocumentMapper().ToDto(result);
         return(CreatedAtAction(nameof(GetDocumentForRoundById), new { id = send.RoundToInvestigationDocumentId }, send));
     }
     catch (Exception e)
     {
         throw new HttpRequestException(e.Message, e, HttpStatusCode.InternalServerError);
     }
 }
예제 #2
0
 public async Task <RoundToInvestigationDocumentDto> AttachDocumentAsync(RoundToInvestigationDocumentDto document)
 {
     return(await new HttpRequestService <RoundToInvestigationDocumentDto>().CreateAsync(document, _document, Api));
 }