public string GetAllActivitiesForInterviewRound(int id)
        {
            var activities = _interviewRoundActivityRepository.GetAllBy(r => r.InterviewRoundId == id, o => o.OrderByDescending(r => r.CreatedOn)).ToList();
            var list       = JsonConvert.SerializeObject(activities, Formatting.None, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            return(list);
        }
Exemple #2
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);
        }