Пример #1
0
        // GET: Job/Edit/5
        public ActionResult Edit(int id)
        {
            var job = uow.jobRepository.Get(id);
            PostJobViewModel model = new PostJobViewModel
            {
                Id = job.ID,
                ApplicationDeadline = job.ApplicationDeadline,
                Country             = job.Country,
                Description         = job.Description,
                ExperienceLevel     = job.ExperienceLevel,
                IsSalaryNegotiable  = job.IsSalaryNegotiable,
                JobType             = job.Type,
                MaximumSalary       = job.MaximumSalary,
                MinimumSalary       = job.MinimumSalary,
                RequiredSkills      = job.RequiredSkills,
                Responsibilities    = job.Responsibilities,
                State = job.State,
                Title = job.Title
            };

            //ViewBag.JobCatId = jobCatRepo.GetAll().AsEnumerable().Select(j => new SelectListItem { Text = j.Name, Value = Convert.ToString(j.ID) });
            ViewBag.JobCatId        = new SelectList(uow.jobCategoryRepository.GetAll(), "ID", "Name", job.JobCategory.ID);
            ViewBag.Type            = new SelectList(Enum.GetValues(typeof(JobType)), job.Type);
            ViewBag.State           = new SelectList(CountryStates.GetStates("Nigeria"), "Value", "Text", job.State);
            ViewBag.ExperienceLevel = new SelectList(Enum.GetValues(typeof(ExperienceLevel)), job.ExperienceLevel);
            return(View(model));
        }
Пример #2
0
 public ActionResult Post()
 {
     ViewBag.JobCatId = uow.jobCategoryRepository.GetAll().AsEnumerable()
                        .Select(j => new SelectListItem {
         Text = j.Name, Value = j.ID.ToString()
     });
     ViewBag.JobType         = new SelectList(Enum.GetValues(typeof(JobType)));
     ViewBag.State           = CountryStates.GetStates("Nigeria");
     ViewBag.ExperienceLevel = new SelectList(Enum.GetValues(typeof(ExperienceLevel)));
     return(View());
 }
Пример #3
0
        // GET: Job/Details/5
        public ActionResult Details(long id, string am = "")
        {
            ViewBag.JobCatId = uow.jobCategoryRepository.GetAll().AsEnumerable()
                               .Select(j => new SelectListItem {
                Text = j.Name, Value = Convert.ToString(j.ID)
            });
            ViewBag.State = CountryStates.GetStates("Nigeria");
            Job  job            = null;
            bool hasUserApplied = false;


            ViewBag.ApplyMsg = jobApplicationService.GetMessage(am);

            ViewBag.NoPitchSubmitted = false;

            var user = userManager.FindById(User.Identity.GetUserId());

            if (user == null)
            {
                ViewBag.HasUserApplied = false;
                ViewBag.IsBookmarked   = false;
            }
            else
            {
                job = uow.jobRepository.Get(id);

                hasUserApplied         = user.jobApplications.Any(j => j.job.ID == id);
                ViewBag.HasUserApplied = hasUserApplied;
                ViewBag.IsBookmarked   = user.FavouriteJobs.Any(j => j.ID == id);

                if (hasUserApplied)
                {
                    var jobApp = uow.jobApplicationRepository.Find(j => j.job.ID == id).FirstOrDefault();
                    if (String.IsNullOrEmpty(jobApp.pitchLocation))
                    {
                        ViewBag.NoPitchSubmitted = true;
                    }
                }
            }
            ViewBag.IsJobFilled         = job.JobStatus == JobStatus.Filled;
            ViewBag.IsApplicationClosed = job.JobStatus == JobStatus.Closed;

            if (ViewBag.IsApplicationClosed && !hasUserApplied)
            {
                ViewBag.ApplyMsg = jobApplicationService.GetMessage("jc");
            }
            else if (ViewBag.IsJobFilled && !hasUserApplied)
            {
                ViewBag.ApplyMsg = jobApplicationService.GetMessage("jf");
            }

            return(View(job));
        }
Пример #4
0
        public ActionResult Post(PostJobViewModel model, string JobCatId)
        {
            if (ModelState.IsValid)
            {
                string userId = User.Identity.GetUserId();
                if (userManager.Users.FirstOrDefault(x => x.Id == userId).IsCompanyUser)
                {
                    try
                    {
                        ViewBag.JobCatId = uow.jobCategoryRepository.GetAll().AsEnumerable()
                                           .Select(j => new SelectListItem {
                            Text = j.Name, Value = j.ID.ToString()
                        });
                        ViewBag.JobType         = new SelectList(Enum.GetValues(typeof(JobType)));
                        ViewBag.State           = CountryStates.GetStates("Nigeria");
                        ViewBag.ExperienceLevel = new SelectList(Enum.GetValues(typeof(ExperienceLevel)));


                        Job job = new Job
                        {
                            Title               = model.Title,
                            State               = model.State,
                            Country             = "Nigeria",
                            Description         = model.Description,
                            RequiredSkills      = model.RequiredSkills,
                            Responsibilities    = model.Responsibilities,
                            Type                = model.JobType,
                            ExperienceLevel     = model.ExperienceLevel,
                            IsSalaryNegotiable  = model.IsSalaryNegotiable,
                            MinimumSalary       = model.MinimumSalary,
                            MaximumSalary       = model.MaximumSalary,
                            ApplicationDeadline = model.ApplicationDeadline,
                            DatePosted          = DateTime.Now,
                            JobCategoryId       = long.Parse(JobCatId),
                            CompanyId           = uow.companyRepository.GetCompanyByUserId(userId).ID,
                        };
                        jobService.PostJob(job);
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        FileLogger.LogError(ex);
                        return(View(model));
                    }
                }
                else
                {
                    throw new ApplicationException("Sorry, only company accounts are priviledged to create a job posting. Kinly confirm your logged-in user account.");
                }
            }
            ViewBag.ErrorMsg = "One or more fields have incorrect data";
            return(View());
        }
Пример #5
0
        public ActionResult Index()
        {
            var model = new HomePageJobsViewModel()
            {
                AllJobs     = uow.jobRepository.GetAll().ToList(),
                HotJobs     = uow.jobRepository.GetAll().OrderByDescending(j => j.DatePosted).ToList(),
                PopularJobs = uow.jobRepository.GetAll().OrderBy(j => j.NumberOfApplicants).ToList()
            };

            ViewBag.TotalJobs          = uow.jobRepository.GetAll().Count();
            ViewBag.TotalCompanies     = uow.companyRepository.GetAll().Count();
            ViewBag.TotalJobCandidates = uow.userRepository.Find(u => u.IsCompanyUser == false).Count();

            ViewBag.State = CountryStates.GetStates("Nigeria");

            return(View(model));
        }
Пример #6
0
        public ActionResult S(string o, string f, string s, string st, string ct, int?p, JobSearchViewModel jsmodelkk, JobListVM vm)
        {
            ViewBag.CurrentSort     = o;
            ViewBag.PopularSortParm = "popular";
            ViewBag.DateSortParm    = o == "Date" ? "date_desc" : "Date";
            ViewBag.SalarySortParm  = "salary_desc";

            if (s != null)
            {
                p = 1;
            }
            else
            {
                s = f;
            }
            ViewBag.CurrentFilter = s;

            var model   = uow.jobRepository.GetAll();
            var jsmodel = new JobSearchViewModel();

            if (vm != null)
            {
                if (vm.JobSearchViewModel != null)
                {
                    jsmodel = vm.JobSearchViewModel;
                }
            }
            ViewBag.Sstr = "";
            if (!String.IsNullOrEmpty(s))
            {
                jsmodel.SearchString = s;
                ViewBag.Sstr         = s;
            }

            ViewBag.Stt = "Job Location";
            if (!String.IsNullOrEmpty(st))
            {
                jsmodel.State = st;
                ViewBag.Stt   = st;
            }

            ViewBag.Cat = "Job Category";
            if (!String.IsNullOrEmpty(ct))
            {
                jsmodel.SearchString = ct;
                ViewBag.Cat          = ct;
            }


            Dictionary <string, object> searchObj = JobModelToDict(jsmodel);

            model = jobService.FindJob(searchObj);

            switch (o)
            {
            case "salary_desc":
                model = model.OrderByDescending(m => m.MaximumSalary);
                break;

            case "popular":
                model = model.OrderByDescending(m => m.NumberOfApplicants);
                break;

            case "Date":
                model = model.OrderBy(m => m.DatePosted);
                break;

            case "date_desc":
                model = model.OrderByDescending(m => m.DatePosted);
                break;

            default:      // Name ascending
                model = model.OrderByDescending(m => m.DatePosted);
                break;
            }

            int pageSize   = 10;
            int pageNumber = (p ?? 1);
            var mod        = new JobListVM
            {
                Jobs = model.ToPagedList(pageNumber, pageSize),
                JobSearchViewModel = jsmodel
            };


            int jobStartNum = GetJobStart(pageNumber, pageSize);
            int jobEndNum   = GetJobEnd(model.Count(), pageNumber, pageSize, jobStartNum);

            ViewBag.StartIndex = jobStartNum;
            ViewBag.EndIndex   = jobEndNum;
            ViewBag.ModelCount = model.Count();

            ViewBag.JobCatId = uow.jobCategoryRepository.GetAll().AsEnumerable()
                               .Select(j => new SelectListItem {
                Text = j.Name, Value = Convert.ToString(j.Jobs.Count())
            });
            ViewBag.State           = CountryStates.GetStates("Nigeria");
            ViewBag.Companies       = uow.companyRepository.GetAll().Select(c => c.Name);
            ViewBag.JobType         = Enum.GetValues(typeof(JobType));
            ViewBag.ExperienceLevel = Enum.GetValues(typeof(ExperienceLevel));
            return(View(mod));
        }