示例#1
0
        public async Task <PersonDocumentDto> PutPersonDocument(int id, PersonDocumentDto model)
        {
            var url    = CRMApiUri + "/PersonDocument/" + id;
            var result = await PutRequestToApi(url, model);

            return(result);
        }
示例#2
0
        public async Task <PersonDocumentDto> PostPersonDocument(PersonDocumentDto model)
        {
            var url    = CRMApiUri + "/PersonDocument";
            var result = await PostRequestToApi(url, model);

            return(result);
        }
示例#3
0
        public async Task <IActionResult> Put(int id, [FromBody] PersonDocumentDto personDocumentDto)
        {
            if (id == 0 || personDocumentDto.Id == 0)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Id needs to be greater than 0."));
            }

            return(await SaveAndReturnEntityAsync(async() => await _personDocumentService.SaveAndReturnEntityAsync(personDocumentDto)));
        }
示例#4
0
        public async Task <IActionResult> Post([FromBody] PersonDocumentDto personDocumentDto)
        {
            if (personDocumentDto.Id != 0)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Identity insert is not permitted."));
            }

            return(await SaveAndReturnEntityAsync(async() => await _personDocumentService.SaveAndReturnEntityAsync(personDocumentDto)));
        }
示例#5
0
        public async Task <BaseEntity> SaveAndReturnEntityAsync(PersonDocumentDto entityDto)
        {
            var personDocument = _mapper.Map <PersonDocument>(entityDto);
            var documentDb     = entityDto.Document;
            var file           = new FileMetadata
            {
                FileContent = documentDb.FileContent,
                FileName    = documentDb.Name,
                PersonId    = documentDb.PersonId,
                UserId      = documentDb.UploadById
            };

            file = await _documentApiClient.EncryptAndSaveFile(file);

            personDocument.Document.RelativePath = file.FileUncPath;
            var result = await _repository.SaveAndReturnEntityAsync(personDocument);

            result.SuccessMessage = "The data is saved successfully";
            return(result);
        }
示例#6
0
 public async Task <PersonDocumentDto> PutPersonDocument(int id, PersonDocumentDto model)
 {
     return(await _personDocumentApiClient.PutPersonDocument(id, model));
 }
示例#7
0
 public async Task <PersonDocumentDto> PostPersonDocument(PersonDocumentDto model)
 {
     return(await _personDocumentApiClient.PostPersonDocument(model));
 }
示例#8
0
        public async Task <int> SaveAsync(PersonDocumentDto personDocument)
        {
            var result = await SaveAndReturnEntityAsync(personDocument);

            return(result.Id);
        }