public async Task <PersonDocumentDto> PutPersonDocument(int id, PersonDocumentDto model) { var url = CRMApiUri + "/PersonDocument/" + id; var result = await PutRequestToApi(url, model); return(result); }
public async Task <PersonDocumentDto> PostPersonDocument(PersonDocumentDto model) { var url = CRMApiUri + "/PersonDocument"; var result = await PostRequestToApi(url, model); return(result); }
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))); }
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))); }
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); }
public async Task <PersonDocumentDto> PutPersonDocument(int id, PersonDocumentDto model) { return(await _personDocumentApiClient.PutPersonDocument(id, model)); }
public async Task <PersonDocumentDto> PostPersonDocument(PersonDocumentDto model) { return(await _personDocumentApiClient.PostPersonDocument(model)); }
public async Task <int> SaveAsync(PersonDocumentDto personDocument) { var result = await SaveAndReturnEntityAsync(personDocument); return(result.Id); }