예제 #1
0
        public ActionResult Update(InterviewRound referal)
        {
            ApiResult <InterviewRound> apiResult;

            if (ModelState.IsValid)
            {
                if (referal.Id > 0)
                {
                    apiResult = TryExecute(() =>
                    {
                        _interviewRoundRepository.Update(referal);
                        _unitOfWork.Commit();
                        return(referal);
                    }, "Interview updated sucessfully");
                }
                else
                {
                    apiResult = TryExecute(() =>
                    {
                        _interviewRoundRepository.Create(referal);
                        _unitOfWork.Commit();
                        return(referal);
                    }, "Interview created sucessfully");
                }
            }
            else
            {
                apiResult = ApiResultFromModelErrors <InterviewRound>();
            }

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult Create(CreateInterviewRoundViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var interviews = new List <int>();
                foreach (var interviewer in vm.InterviewerIds.ToList())
                {
                    var newInterviewRound = new InterviewRound()
                    {
                        JobOpeningId  = vm.JobOpeningId,
                        CandidateId   = vm.CandidateId,
                        RoundId       = vm.RoundId,
                        InterviewerId = interviewer,
                        ScheduledOn   = vm.ScheduledOn,
                        Status        = InterviewStatus.Scheduled,
                        Comments      = vm.Comments
                    };

                    _interviewRoundRepository.Create(newInterviewRound);
                    _unitOfWork.Commit();
                    interviews.Add(newInterviewRound.Id);
                }

                foreach (var interviewId in interviews)
                {
                    #if !DEBUG
                    _emailComposerService.InterviewScheduled(interviewId);
                    #endif
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.CandidateId   = new SelectList(_candidateRepository.GetAll(o => o.OrderByDescending(c => c.Id), "Person").Select(c => new { c.Id, Name = c.Person.Name + "- [" + c.Code + "]" }), "Id", "Name");
            ViewBag.InterviewerId = new MultiSelectList(_userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.Id != 1, "Person"), "Id", "Person.Name", vm.InterviewerIds);
            ViewBag.JobOpeningId  = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title");
            ViewBag.RoundId       = new SelectList(_roundRepository.GetAll(), "Id", "Title");

            return(View(vm));
        }
예제 #3
0
        public JsonResult AddInterviewRound(CreateInterviewRoundViewModel vm)
        {
            try
            {
                var interviews = new List <int>();
                foreach (var interviewer in vm.InterviewerIds.ToList())
                {
                    var newInterviewRound = new InterviewRound
                    {
                        JobOpeningId  = vm.JobOpeningId,
                        CandidateId   = vm.CandidateId,
                        RoundId       = vm.RoundId,
                        InterviewerId = interviewer,
                        ScheduledOn   = vm.ScheduledOn,
                        Status        = InterviewStatus.Scheduled,
                        Comments      = vm.Comments
                    };

                    _interviewRoundRepository.Create(newInterviewRound);
                    _unitOfWork.Commit();
                    interviews.Add(newInterviewRound.Id);
                }

                foreach (var interviewId in interviews)
                {
#if !DEBUG
                    _emailComposerService.InterviewScheduled(interviewId);
#endif
                }

                return(Json(true));
            }
            catch (Exception)
            {
                return(Json(false));
            }
        }