示例#1
0
        /// <summary>
        /// This method fetches Home page for Admin
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> AdminIndex()
        {
            //counter part
            AdminPanelViewModel collection = new AdminPanelViewModel();

            try
            {
                collection.ApplicationCount       = _dbContext.Candidate.Where(x => x.emailConfirmed == true).Count();
                collection.ActiveApplicationCount = _dbContext.jobApplications.ToList().Where(x => x.status == status_Pending).Count();
                collection.InterviewerCount       = _dbContext.Users.Count();
                collection.SelectedCount          = _dbContext.jobApplications.Where(x => x.status == status_Complete).Count();

                //upcoming schedules scheduleviewmodels
                var upcoming_schedules = await _schedulesPage.GetSchedulesByUserId(_userManager.GetUserId(HttpContext.User));

                collection.upcoming_schedules = upcoming_schedules.Where(x => x.status != reqValue).ToList();

                //notification jobapplicationViewModels.
                var notifyJobApplications = await _jobApplicationPage.getJobApplications();

                collection.selected_application = notifyJobApplications.Where(x => x.status == status_Complete && x.notified == false).ToList();
                foreach (var item in collection.selected_application)
                {
                    item.candidateName = _dbContext.Candidate.Where(x => x.ID == item.candidateId).FirstOrDefault().name;
                    item.position      = getPositionByCandidateId(item.candidateId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(View(collection));
        }
        /// <summary>
        /// SHOWING ALL THE PENDING SCHEDULES FOR INTERVIEWER
        /// </summary>
        /// <returns></returns>
        //public async Task<IActionResult> Index(string SearchString)
        //{
        //    slist = await _schedulesPage.GetSchedulesByUserId(_userManager.GetUserId(HttpContext.User));

        //    try
        //    {
        //        //filtering the schedules for getting only the incompleted schedules
        //        slist = slist.Where(x => x.status != reqValue);
        //        //Added search box test
        //        if (!String.IsNullOrEmpty(SearchString))
        //        {
        //            slist = slist.Where(s => s.position.ToUpper().Contains(SearchString.ToUpper()));
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine(ex.Message);
        //    }

        //    return View(slist);
        //}


        /// <summary>
        /// SHOWING ALL THE COMPLETED SCHEDULES FOR INTERVIEWER
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> IndexCompleted(string SearchString)
        {
            slist = await _schedulesPage.GetSchedulesByUserId(_userManager.GetUserId(HttpContext.User));

            try
            {
                //filtering the schedules for getting only the incompleted schedules
                slist = slist.Where(x => x.status == reqValue);
                //Added search box test
                if (!String.IsNullOrEmpty(SearchString))
                {
                    slist = slist.Where(s => s.position.ToUpper().Contains(SearchString.ToUpper()));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(View(slist));
        }