public async Task <Unit> Handle(CreateInterviewProcessCommand request, CancellationToken cancellationToken) { var entity = new InterviewProcess { CandidateId = request.CandidateId, FeedbackStatus = request.FeedbackStatus, StartDate = System.DateTime.Now, EndDate = System.DateTime.Now }; _context.Add(entity); return(Unit.Value); }
/// <summary> /// Add interivew process /// </summary> /// <param name="process">interview process</param> /// <param name="listRound">list interview round in process</param> /// <returns> /// Success: interview process id /// Error: bad id (0), exception /// </returns> public int AddProcess(InterviewProcess process, List <RoundProcess> listRound) { log.Info(String.Format("Function: AddProcess - process: {0} - listRound: {1}", process, listRound)); //Add interview process InterviewProcess processAddResult = _interviewProcessRepository.Add(process); if (processAddResult == null) { log.Info(String.Format("Process: {0} - Message: Add interview process failed!", process)); return(intBadId); } else { //add interview round to process RoundProcess addRoundProcessResult = new RoundProcess(); int roundOrder = 1; foreach (RoundProcess roundProcess in listRound) { roundProcess.InterviewProcessID = processAddResult.ID; roundProcess.RoundOrder = roundOrder; addRoundProcessResult = _roundProcessRepository.Add(roundProcess); if (addRoundProcessResult == null) { log.Info(String.Format("Process: {0} - ListRound: {1} - Message: Add interview process failed", process, listRound)); return(intBadId); } roundOrder = roundOrder + 1; } //save work try { Save(); } catch (Exception exc) { throw new Exception(exc.Message); } return(processAddResult.ID); } }