Exemple #1
0
        public PartialViewResult SearchApplicants(string searchText, char val)
        {
            List <UserViewModel> model = ApplicantsService.GetAllApplicants();

            searchText = searchText.ToLower();
            List <UserViewModel> result = null;

            switch (val)
            {
            case '1':
                result = model.Where(x => x.FirstName.ToLower().Contains(searchText)).ToList();
                break;

            case '2':
                result = model.Where(x => x.Lastname.ToLower().Contains(searchText)).ToList();
                break;

            case '3':
                result = model.Where(x => x.CompletionPercentage.ToString().Contains(searchText)).ToList();
                break;

            case '4':
                result = model.Where(x => x.EmailId.ToLower().Contains(searchText)).ToList();
                break;
            }

            return(PartialView("_TableView", result));
        }
Exemple #2
0
        public PartialViewResult FilterApplicantsByCareerPathThenSort(char filterVal, char sortVal)
        {
            List <UserViewModel> model  = ApplicantsService.GetAllApplicants();
            List <UserViewModel> result = null;

            LogService.Write("FilterVal: " + filterVal);
            if (filterVal.Equals('1'))
            {
                result = model.Where(x => x.CareerPath.Equals(CareerPath.Administrator.ToString()) && (x.CompletionPercentage > 0.0)).ToList();
                LogService.Write("Admin:" + result.Count.ToString());
            }
            else if (filterVal.Equals('2'))
            {
                result = model.Where(x => x.CareerPath.Equals(CareerPath.Developer.ToString()) && x.CompletionPercentage > 0.0).ToList();
            }
            else
            {
                result = model.Where(x => x.CompletionPercentage > 0.0).ToList();
                LogService.Write("Default:" + result.Count.ToString());
            }

            switch (sortVal)
            {
            case '1':
                result = result.OrderBy(x => x.FirstName).ToList();
                break;

            case '2':
                result = result.OrderBy(x => x.Lastname).ToList();
                break;

            case '3':
                result = result.OrderBy(x => x.CareerPath).ToList();
                break;

            case '5':
                result = result.OrderBy(x => x.EmailId).ToList();
                break;

            default:
                result = result.OrderByDescending(x => x.CompletionPercentage).ToList();
                break;
            }


            return(PartialView("_TableView", result));
        }
Exemple #3
0
 public HomeController(ILogger <HomeController> logger, ApplicantsService applicantsService)
 {
     _logger = logger;
     _appSvc = applicantsService;
 }
Exemple #4
0
 public ApplicantsController(ApplicantsService applicantsService)
 {
     _applicantsService = applicantsService;
 }
Exemple #5
0
        // GET: Admin
        public ActionResult Index()
        {
            var applicants = ApplicantsService.GetAllApplicants();

            return(View(applicants));
        }
Exemple #6
0
        public ActionResult ApplicantDetails(int id)
        {
            UserViewModel applicant = ApplicantsService.GetApplicant(id);

            return(View("ApplicantDetails", applicant));
        }