Beispiel #1
0
        public int CreateProcess(int documentIdentifier, ProcessFormDto processDto)
        {
            processDto.DocumentId = documentIdentifier;
            var process = mapper.Map <Process>(processDto);

            return(processRepository.Create(process));
        }
Beispiel #2
0
        public CreatedProcessContract Create(CreateProcessContract createProcessContract)
        {
            var process = _mapper.Map <Process>(createProcessContract);

            //var candidate = _mapper.Map<Candidate>(createProcessContract.Candidate);
            _candidateRepository.Update(process.Candidate);

            //process.Candidate = candidate;

            //var candidate = _candidateRepository.QueryEager().FirstOrDefault(c => c.Id == process.Candidate.Id);

            //var updatedCandidate = _candidateRepository.Update(candidate);

            //process.Candidate = updatedCandidate;
            //process.CandidateId = updatedCandidate.Id;

            this.AddRecruiterToCandidate(process.Candidate, createProcessContract.Candidate.Recruiter);
            this.AddOfficeToCandidate(process.Candidate, createProcessContract.Candidate.PreferredOfficeId);
            var createdProcess = _processRepository.Create(process);

            _unitOfWork.Complete();

            var createdProcessContract = _mapper.Map <CreatedProcessContract>(createdProcess);

            return(createdProcessContract);
        }
Beispiel #3
0
        public Guid Create(Stream stream)
        {
            if (stream is null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            Guid processIdentifier = processRepository.Create();
            int  blobIdentifier    = blobService.Load(stream, processIdentifier.ToString());

            processRepository.AssignBlob(processIdentifier, blobIdentifier);

            ProcessStatus processStatus = ProcessStatus.Started;

            processRepository.UpdateStatus(processIdentifier, processStatus);

            try
            {
                Stream processed = process.Process(processIdentifier);

                blobService.AssingBlobProcessed(blobIdentifier, processed);

                processStatus = ProcessStatus.Succeded;
            }
            catch (Exception ex)
            {
                processStatus = ProcessStatus.Failed;
            }
            finally
            {
                processRepository.UpdateStatus(processIdentifier, processStatus);
            }

            return(processIdentifier);
        }