예제 #1
0
        public async Task <IActionResult> Evaluation(int assessmentid)
        {
            var query = await _context.Assessment
                        .Include(x => x.Responses)
                        .Include(x => x.Candidate).ThenInclude(x => x.User)
                        .Include(x => x.JobOrder)
                        .Where(x => x.Id == assessmentid)
                        .Select(x => new
            {
                assessmentid = x.Id,
                rating       = x.TotalRating,
                uploadedon   = x.UpdatedOn,
                Candidate    = new { id = x.Candidate.Id, name = x.Candidate.Name, position = x.Candidate.Position, skills = x.Candidate.Skills, userid = x.Candidate.UserId, photo = _helperService.GetUserPhoto(x.Candidate.User) },
                Responses    = _context.vwCandidateJob
                               .Where(a => a.AssessmentId == x.Id)
                               .Select(r => new {
                    id          = r.Id,
                    questionid  = r.QuestionId,
                    question    = r.QuestionTitle,
                    video       = string.IsNullOrEmpty(r.Videofile) ? r.Videofile : _helperService.GetMediaUrl(x.Candidate.User.UserGuid.ToString()) + "/" + r.Videofile,
                    rating      = r.Rating,
                    notes       = r.Notes,
                    duration    = r.Duration,
                    orderbyid   = r.OrderById,
                    status      = r.Status,
                    description = r.Description
                }).OrderBy(o => o.orderbyid).ToList()
            })
                        .SingleOrDefaultAsync();

            return(Ok(new { StatusCode = StatusCodes.Status200OK, result = query }));
        }
예제 #2
0
        public async Task <IActionResult> Questions(int assessmentid)
        {
            User user = _helperService.GetUser();

            if (user == null)
            {
                return(Ok(new ErrorDto {
                    StatusCode = StatusCodes.Status401Unauthorized, Message = "Unauthorized"
                }));
            }
            else
            {
                var CandidateJob = await _context.vwCandidateJob
                                   .Where(x => (x.AssessmentId == assessmentid))
                                   .Select(x => new
                {
                    assessmentid = x.AssessmentId,
                    questionid   = x.QuestionId,
                    question     = (x.Status == null || x.Status == 0)  ? "Question": x.QuestionTitle,
                    description  = (x.Status == null || x.Status == 0) ? "Description" : x.Description,
                    duration     = x.Duration,
                    Buffer       = ((x.BufferTime == null) ? 0 : x.BufferTime),
                    uploadedon   = x.UploadedOn,
                    video        = string.IsNullOrEmpty(x.Videofile)? x.Videofile  : _helperService.GetMediaUrl(user.UserGuid.ToString()) + "/" + x.Videofile,
                    orderid      = x.OrderById,
                    status       = x.Status
                }).OrderBy(x => x.orderid)
                                   .ToListAsync();

                var docs = await _context.DocumentTemplate.ToListAsync();

                var forms = await _context.FormTemplate.ToListAsync();

                return(Ok(new { StatusCode = StatusCodes.Status200OK, result = CandidateJob, result2 = docs, result3 = forms }));
            }
        }