public async Task <ActionResult> Post( [FromForm] DocumentRequestDto documentDto, [FromServices] IMapper mapper, [FromServices] ICommandDispatcher commandDispatcher) { return(Ok((await commandDispatcher.Dispatch(new CreateDocumentCommand( documentDto.Name, documentDto.DocumentStatusId, mapper.Map <FileDto>(documentDto.File))).ConfigureAwait(false)).IsSuccess)); }
public async Task <ActionResult <DocumentResponseDto> > Add(DocumentRequestDto documentDto) { var document = await _service.Add(_mapper.Map <ProviderDocument>(documentDto)); if (_notification.Any) { return(BadRequest(_notification.Messages)); } return(Ok(_mapper.Map <DocumentResponseDto>(document))); }
private DocumentSaveSuccessResponse CreateDocument <T>(Guid vaultId, DocumentRequestDto <T> documentRequestDto) where T : class, new() { try { return (VaultDocumentsUrl(vaultId) .PostToUrl(documentRequestDto, requestFilter: AuthorizationHeader) .AutoMapResponseDto <DocumentSaveSuccessResponseDto, DocumentSaveSuccessResponse>()); } catch (WebException wex) { throw ParseWebException(wex); } }