Exemplo n.º 1
0
        public string GetAllActivitiesForCandidate(int id)
        {
            var interviews          = _interviewRoundRepository.GetAllBy(i => i.CandidateId == id).Select(i => i.Id);
            var interviewActivities = _interviewRoundActivityRepository.GetAllBy(a => interviews.Contains(a.InterviewRoundId)).Select(a => new ActivityModel()
            {
                Title     = a.Title,
                Comment   = a.Comment,
                CreatedOn = a.CreatedOn
            }).ToList();

            var activities = _candidateActivityRepository.GetAllBy(r => r.CandidateId == id, o => o.OrderByDescending(r => r.CreatedOn)).Select(a => new ActivityModel()
            {
                Title     = a.Title,
                Comment   = a.Comment,
                CreatedOn = a.CreatedOn
            }).ToList();

            interviewActivities.AddRange(activities);
            interviewActivities = interviewActivities.OrderByDescending(o => o.CreatedOn).ToList();
            var list = JsonConvert.SerializeObject(interviewActivities, Formatting.None, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            return(list);
        }
        public ActionResult Today()
        {
            var today            = DateTime.UtcNow.Date;
            var todaysInterviews = _interviewRoundRepository.GetAllBy(t => t.Status == InterviewStatus.Scheduled && System.Data.Entity.DbFunctions.TruncateTime(t.ScheduledOn) == today);

            foreach (var interview in todaysInterviews)
            {
                var interviewId = interview.Id;

                #if !DEBUG
                _emailComposerService.InterviewReminder(interviewId);
                #endif
            }

            return(Json(true, JsonRequestBehavior.AllowGet));
        }