public ActionResult Register(Models.User user) { var entities = new Job_Candidate_Application_Entities(); if (ModelState.IsValid) { if (user.Email != null && user.RegisterUser(user.FirstName, user.LastName, user.Password, user.Email, guid.ToString())) { //user registration successful //Guid guid = Guid.NewGuid(); Manager.EmailManager.SendConfirmationEmail(user.FirstName, user.Email, guid.ToString()); return(RedirectToAction("Confirmation", "User")); //FormsAuthentication.SetAuthCookie(user.Email, user.RememberMe); //return RedirectToAction("Profile", "User"); } //check for duplicate email address else if (entities.Tbl_Users.Any(r => r.Email_Id == user.Email)) { ModelState.AddModelError("", "Account with email address already exists. Login instead."); } //incorrect information in one or more fields else { ModelState.AddModelError("", "Registration data is incorrect!"); } } return(View(user)); }
public ActionResult AdminLoggedIn(int?page) { var entities = new Job_Candidate_Application_Entities(); var model = from r in entities.Tbl_Users select r; int pageSize = 3; int pageNum = (page ?? 1); AdminLoggedInViewModel viewModel = new AdminLoggedInViewModel(); // string userName = User.Identity.Name; //viewModel.recJobs = getRecommendedJobs(userName, viewModel); if (viewModel.numPagesRecUsers == 0) { var userentities = new Job_Candidate_Application_Entities(); IList <Tbl_Users> mylist = userentities.Tbl_Users.ToList(); //var sixRandomFoos = mylist.OrderBy(x => Guid.NewGuid()).Take(6); viewModel.recUsers = mylist; } if (User.Identity.IsAuthenticated) { viewModel.pagedList = model.OrderBy(p => p.User_Last_Name).ToPagedList(pageNum, pageSize); return(View(viewModel)); } else { return(RedirectToAction("Login", "User")); } }
public ActionResult Details(int?id = 0) { if (id == 0) { return(RedirectToAction("Index")); } //var entities = new JobDbEntities(); var entities = new Job_Candidate_Application_Entities(); Session["hasApplied"] = ""; //Job jobs = entities.Jobs.Where(x=>x.Job_Id == id).Select(x => // new Job // ) Tbl_Jobs jobs = entities.Tbl_Jobs.Find(id); var user = new Models.Apply(); var email = User.Identity.Name; if (jobs == null) { return(HttpNotFound()); } else if (user.hasApplied(email, jobs.Job_Id) == true) { Session["hasApplied"] = "You have applied for this job"; } return(View(jobs)); }
public ActionResult Profile() { if (User.Identity.IsAuthenticated) { UserProfile user = new UserProfile(); var entities = new Job_Candidate_Application_Entities(); //logged in user email var email = User.Identity.Name; var model = entities.Tbl_Users.Find(email); //store user information in UserProfile class user.FirstName = model.User_First_Name; user.LastName = model.User_Last_Name; user.Street = model.User_Street; user.City = model.User_City; user.State = model.User_State; user.Country = model.User_Country; user.PhoneNumber = model.User_Phone_Number; user.Skills = model.Skills; user.Experience_Years = model.Exp_Years; return(View(user)); } else { //user not authenticated return(RedirectToAction("Login", "User")); } }
// // GET: /Home/ public ActionResult Index() { var entities = new Job_Candidate_Application_Entities(); IList <Tbl_Jobs> mylist = entities.Tbl_Jobs.ToList(); var sixRandomFoos = mylist.OrderBy(x => Guid.NewGuid()).Take(6); return(View(sixRandomFoos)); }
public ActionResult Apply(int?id = 0) { if (id == null) { return(RedirectToAction("Index", "JobSearch")); } if (User.Identity.IsAuthenticated) { var applyJob = new Models.Apply(); var email = User.Identity.Name; var entities = new Job_Candidate_Application_Entities(); var job = entities.Tbl_Jobs.Find(id); var userInfo = entities.Tbl_Users.Find(email); if (applyJob.hasApplied(email, job.Job_Id) == false) { applyJob.JobPosition = job.Position; applyJob.JobId = job.Job_Id; applyJob.EmailId = userInfo.Email_Id; applyJob.FirstName = userInfo.User_First_Name; applyJob.LastName = userInfo.User_Last_Name; applyJob.Street = userInfo.User_Street; applyJob.City = userInfo.User_City; applyJob.State = userInfo.User_State; applyJob.Country = userInfo.User_Country; applyJob.PhoneNumber = userInfo.User_Phone_Number; applyJob.Skills = userInfo.Skills; applyJob.ExperienceYears = userInfo.Exp_Years; //if (userInfo.Resume_Upload == null) //{ // applyJob.ResumePath = null; //} //else //{ applyJob.ResumePath = userInfo.Resume_Upload; //} //var errors = ModelState.Select(x => x.Value.Errors) // .where(y => y.count > 0) // .tolist(); return(View(applyJob)); } else { Session["submitApplication"] = "You have already applied for the job"; return(View("SubmitApplication")); } } else { return(RedirectToAction("Login", "User")); } }
public ActionResult ChangePassword(Models.ChangePassword model) { Session["changePassword"] = null; try { var entities = new Job_Candidate_Application_Entities(); string email = Request["email"]; if (ModelState.IsValid) { string currentPassword = null; if (User.Identity.IsAuthenticated) { email = User.Identity.Name; currentPassword = model.CurrentPassword; var verifyCurrentPassword = entities.Tbl_Users.Find(email).Password; if (verifyCurrentPassword != Helpers.SHA1.Encode(currentPassword)) { ModelState.AddModelError("", "Current password is incorrect! Try again"); return(View(model)); } } string password = model.Password; guid = Guid.NewGuid(); //update change to invalidate change password link in the email //update password in the database if (model.UpdatePassword(email, currentPassword, password, guid.ToString())) { model.EmailId = email; model.CurrentPassword = null; model.Password = null; model.ConfirmPassword = null; Session["changePassword"] = "******"; return(View(model)); } } else { // ModelState.AddModelError("", "Error occured! Try again!"); model.EmailId = email; return(View(model)); } } catch (Exception ex) { //Session["changePassword"] = ex.Message; ModelState.AddModelError("", "Error occured! Try again!"); return(View(model)); } //something happened. display page again return(View(model)); }
public ActionResult Verify() { try { string guidToTest = Request["id"]; string email = Request["email"]; var entities = new Job_Candidate_Application_Entities(); var model = entities.Tbl_Users.Find(email); var is_active = model.Is_Active; //user has not confirmed yet if (is_active == 0) { if (email != null && guidToTest != null) { var user = new Models.User(); var guid = model.User_Guid; if (guidToTest == guid.ToString() && is_active == 0) { //email confirmed if (user.Confirmed(email) == true) { Session["verify"] = "Thank you for verifying your email. You can now log in to the account, set up your profile and apply to jobs. The distance between you and your career has never been closer."; return(View()); } //FormsAuthentication.SetAuthCookie(user.Email, true); //return RedirectToAction("LogIn", "User"); } else { Session["verify"] = "Error in verifying your email. Please try again!"; return(View()); } } } else { Session["verify"] = "Email has already been confirmed. Please try to login."; return(View()); } } catch (Exception ex) { Session["verify"] = ex.Message; } //something happened. redirect user to home screen return(RedirectToAction("Index", "Home")); }
public ActionResult ChangePassword() { Session["changePassword"] = null; try { string guid = Request["id"]; string email = Request["email"]; var entities = new Job_Candidate_Application_Entities(); if (!User.Identity.IsAuthenticated && guid != null && email != null) { var model = new Models.ChangePassword(); var verifyEmail = entities.Tbl_Users.Find(email); string isGuidValid = verifyEmail.User_Guid; if (guid != isGuidValid) { ModelState.AddModelError("", "Link is not valid."); return(View(model)); } else if (verifyEmail != null) { //user has not confirmed yet if (email != null && guid != null) { model.EmailId = email; return(View(model)); } } else { ModelState.AddModelError("", "Email ID could not be found!"); return(View(model)); } } else if (User.Identity.IsAuthenticated) { return(View()); } else { return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { Session["verify"] = ex.Message; } //something happened. redirect user to home screen return(RedirectToAction("Index", "Home")); }
public ActionResult Login(Models.LoginUser user) { if (ModelState.IsValid) { if (user.IsAdmin(user.Email, user.Password)) { //Admin Login FormsAuthentication.SetAuthCookie(user.Email, user.RememberMe); return(RedirectToAction("AdminLoggedIn", "User")); } else if (user.IsValid(user.Email, user.Password)) { //login successful FormsAuthentication.SetAuthCookie(user.Email, user.RememberMe); return(RedirectToAction("LoggedIn", "User")); } else { //incorrect login information var entities = new Job_Candidate_Application_Entities(); bool model = entities.Tbl_Users.Any(u => u.Email_Id == user.Email); if (model) { ModelState.AddModelError("", "Account is not active"); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } } /* * ****error tracing***** */ //else //{ // var errors = ModelState.Select(x => x.Value.Errors) // .Where(y => y.Count > 0) // .ToList(); //} return(View(user)); }
private static IEnumerable <Tbl_Jobs> getRecommendedJobs(string userName, LoggedInViewModel viewModel) { var entities = new Job_Candidate_Application_Entities(); Tbl_Users user = entities.Tbl_Users.Find(userName); if (user != null) { viewModel.name = user.User_First_Name; string skills = user.Skills; var results = from r in entities.Tbl_Jobs where r.Required_Skills.Contains("skills") select r; IList <Tbl_Jobs> recJobsList = results.ToList(); int numresults = recJobsList.Count; int numpages = numresults / 6; viewModel.numRecJobs = 6 * numpages; viewModel.numPagesRecJobs = numpages; var randomFoos = recJobsList.OrderBy(x => Guid.NewGuid()).Take((numpages * 6)); return(randomFoos); } return(null); }
public ActionResult ForgotPassword(Models.ForgotPassword forgotPassword) { string email = forgotPassword.EmailId; Session["forgotPassword"] = null; if (email != null) { var model = new Job_Candidate_Application_Entities(); var user = model.Tbl_Users.Find(email); if (user != null) { Session["forgotPassword"] = "******"; var guid = Guid.NewGuid(); //create unique global id string firstName = user.User_First_Name; if (forgotPassword.updateGuid(email, guid.ToString())) { //guid was updated in database, send email to user Manager.EmailManager.SendForgotPasswordEmail(firstName, email, guid.ToString()); } return(View()); } else { Session["forgotPassword"] = "******"; return(View()); } } else { ModelState.AddModelError("", "Error occurred. Try again!!"); return(View()); } //something happened, send user back to home page return(RedirectToAction("Index", "Home")); }
// // GET: /JobSearch/ public ActionResult Index(string city, string customer) { // var entities = new JobDbEntities(); var entities = new Job_Candidate_Application_Entities(); ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); var model = (from r in entities.Tbl_Jobs where r.Customer == customer || r.City_Name == city select r); if (city != null || customer != null) { return(View(model)); } else { return(View(entities.Tbl_Jobs.ToList())); } }
public ActionResult Apply(Models.Apply applyJob, HttpPostedFileBase resume) { //var user = new Models.Apply(); string email = applyJob.EmailId; int jobId = applyJob.JobId; string firstName = applyJob.FirstName; string lastName = applyJob.LastName; string street = applyJob.Street; string city = applyJob.City; string state = applyJob.State; string country = applyJob.Country; string phoneNumber = applyJob.PhoneNumber; string skills = applyJob.Skills; int? experienceYears = applyJob.ExperienceYears; bool useExistingResume = applyJob.UseExistingResume; string resumePath = null; if (User.Identity.IsAuthenticated) { if (useExistingResume) { var entities = new Job_Candidate_Application_Entities(); var user = entities.Tbl_Users.Find(email); resumePath = user.Resume_Upload; } else if (resume != null) { var entities = new Job_Candidate_Application_Entities(); var user = entities.Tbl_Users.Find(email); var allowedExtension = new[] { ".pdf", ".txt", ".doc", ".docx" }; var model = new Models.UploadResume(); string firstNameInitial = user.User_First_Name[0].ToString(); //user first name initial string date = DateTime.Now.ToString(); //current date and time to make file unique //remove unsupported characters in file name date = date.Replace('/', '-'); date = date.Replace(':', '.'); //name of uploaded document string fileName = Path.GetFileName(resume.FileName); string extension = Path.GetExtension(fileName); //validate extension of uploaded file if (!allowedExtension.Contains(extension)) { ModelState.AddModelError("", "Document not supported. Only upload pdf, txt, doc or docx documents only!"); if (!String.IsNullOrWhiteSpace(user.Resume_Upload)) { applyJob.ResumePath = user.Resume_Upload; } return(View(applyJob)); } string tempFileName = fileName; //unique file name fileName = lastName + "_" + firstNameInitial + "_" + date + "_" + tempFileName; resumePath = Path.Combine(Server.MapPath("~/App_Data/Applicant's Resumes"), fileName); resume.SaveAs(resumePath); } //if (model.StoreResumePathInJobApplicationProfile(email, path)) //{ // return View(); //} //else //{ // ModelState.AddModelError("", "Error occured in uploading resume. Try again."); // return View(); //} if (ModelState.IsValid) { if (applyJob.submitApplication(email, jobId, firstName, lastName, street, city, state, country, phoneNumber, skills, experienceYears, resumePath)) { Session["submitApplication"] = "Application was submitted successfully. Thank you for your interest."; } else { Session["submitApplication"] = "There was an error in submitting your application. Please try again. Sorry for the inconvenience"; } return(View("SubmitApplication")); } else { ModelState.AddModelError("", "Error submitting application. Make sure required fields are not empty"); return(View(applyJob)); } //error tracing //var errors = ModelState.Select(x => x.Value.Errors) // .Where(y => y.Count > 0) // .ToList(); } else { return(RedirectToAction("Index", "JobSearch")); } return(RedirectToAction("Index", "JobSearch")); }
public ActionResult UploadResume(HttpPostedFileBase resume) { try { if (User.Identity.IsAuthenticated) { if (resume != null && resume.ContentLength > 0) { var entities = new Job_Candidate_Application_Entities(); var allowedExtension = new[] { ".pdf", ".txt", ".doc", ".docx" }; var model = new Models.UploadResume(); string email = User.Identity.Name; var user = entities.Tbl_Users.Find(email); string lastName = user.User_Last_Name; //user last name string firstName = user.User_First_Name[0].ToString(); //user first name initial string date = DateTime.Now.ToString(); //current date and time to make file unique //remove unsupported characters in file name date = date.Replace('/', '-'); date = date.Replace(':', '.'); //name of uploaded document string fileName = Path.GetFileName(resume.FileName); string extension = Path.GetExtension(fileName); //validate extension of uploaded file if (!allowedExtension.Contains(extension)) { ModelState.AddModelError("", "Document not supported. Only upload pdf, txt, doc or docx documents only!"); Session["uploadResume"] = null; return(View()); } string tempFileName = fileName; //unique file name fileName = lastName + "_" + firstName + "_" + date + "_" + tempFileName; string path = Path.Combine(Server.MapPath("~/App_Data/Applicant's Resumes"), fileName); resume.SaveAs(path); if (model.StoreResumePathInUserProfile(email, path)) { Session["uploadResume"] = "File uploaded successfully"; return(View()); } else { ModelState.AddModelError("", "Error occured in uploading resume. Try again."); return(View()); } } else { ModelState.AddModelError("", "No file uploaded!"); Session["uploadResume"] = null; return(View()); } } else { return(RedirectToAction("Login", "User")); } } catch (Exception ex) { ModelState.AddModelError("", "Error occurred! Try again!"); return(View()); } //something happened, redirect user back to home page. return(RedirectToAction("Index", "Home")); }
public ActionResult LoggedIn(/*string city, string customer, int? page*/) { //var entities = new Job_Candidate_Application_Entities(); //if (city != null && (city != "" || city != "Select One")) //{ // ViewBag.LocationLabel = city; // ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); //} //if (customer != null && (customer != "" || customer != "Select One")) //{ // ViewBag.CustomerLabel = customer; // ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); //} //if (page == null && city == null && customer == null) //{ // ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); // ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); // ViewBag.LocationLabel = "Select One"; // ViewBag.CustomerLabel = "Select One"; //} //else if ((city == "" || city == "Select One")) //{ // ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); // ViewBag.LocationLabel = "Select One"; // city = ""; //} //else if ((customer == "" || customer == "Select One")) //{ // ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); // ViewBag.CustomerLabel = "Select One"; // customer = ""; //} //var model = from r in entities.Tbl_Jobs select r; //if (city != "" || customer != "") //{ // if (city != "" && customer != "") // { // model = (from r in entities.Tbl_Jobs where r.Customer == customer && r.City_Name == city select r); // } // else if (city != "") // { // model = (from r in entities.Tbl_Jobs where r.City_Name == city select r); // } // else // { // model = (from r in entities.Tbl_Jobs where r.Customer == customer select r); // } //} //else //{ // model = from r in entities.Tbl_Jobs where r.Position == "dkjfldjls" select r; //} //int pageSize = 3; //int pageNum = (page ?? 1); LoggedInViewModel viewModel = new LoggedInViewModel(); string userName = User.Identity.Name; viewModel.recJobs = getRecommendedJobs(userName, viewModel); if (viewModel.numPagesRecJobs == 0) { var jobentities = new Job_Candidate_Application_Entities(); IList <Tbl_Jobs> mylist = jobentities.Tbl_Jobs.ToList(); var sixRandomFoos = mylist.OrderBy(x => Guid.NewGuid()).Take(6); viewModel.recJobs = sixRandomFoos; } if (User.Identity.IsAuthenticated) { //viewModel.pagedList = model.OrderBy(p => p.Position).ToPagedList(pageNum, pageSize); return(View(viewModel)); } else { return(RedirectToAction("Login", "User")); } }
public ActionResult SearchUsers(View_Models.AdminLoggedInViewModel user) { AdminLoggedInViewModel viewModel = new AdminLoggedInViewModel(); string fname = user.Fname; string lname = user.Lname; string Email = user.Email; int pageSize = 3; var entities = new Job_Candidate_Application_Entities(); var model = from r in entities.Tbl_Users where (r.User_First_Name == fname) && (r.User_Last_Name == lname) && (r.Email_Id == Email) select r; if (fname != null && lname != null && Email != null) { model = from r in entities.Tbl_Users where (r.User_First_Name == fname) && (r.User_Last_Name == lname) && (r.Email_Id == Email) select r; } else if (fname != null && lname != null && Email == null) { model = from r in entities.Tbl_Users where (r.User_First_Name == fname) && (r.User_Last_Name == lname) select r; } else if (fname != null && lname == null && Email != null) { model = from r in entities.Tbl_Users where (r.User_First_Name == fname) && (r.Email_Id == Email) select r; } else if (fname == null && lname != null && Email != null) { model = from r in entities.Tbl_Users where (r.User_Last_Name == lname) && (r.Email_Id == Email) select r; } else if (fname != null && lname == null && Email == null) { model = from r in entities.Tbl_Users where (r.User_First_Name == fname) select r; } else if (fname == null && lname != null && Email == null) { model = from r in entities.Tbl_Users where (r.User_Last_Name == lname) select r; } else if (fname == null && lname == null && Email != null) { model = from r in entities.Tbl_Users where (r.Email_Id == Email) select r; } else { return(RedirectToAction("SearchUsersFailed", "User")); } if (User.Identity.IsAuthenticated) { viewModel.pagedList = model.OrderBy(p => p.User_Last_Name).ToPagedList(1, pageSize); if (viewModel.pagedList.Count() > 0) { return(View(viewModel)); } else { return(RedirectToAction("SearchUsersFailed", "User")); } } else { return(RedirectToAction("Login", "User")); } }
public ActionResult UserJobSearch(string city, string customer, int?page, FormCollection form) { var entities = new Job_Candidate_Application_Entities(); string selectedSkills = form["skills"]; string selectedCity = form["city"]; string selectedCustomer = form["customer"]; List <string> skillsList = null; if (selectedCity == null && (city != null && city != "" && city != "Select One")) { selectedCity = city; } if (selectedCustomer == null && (customer != null && customer != "" && customer != "Select One")) { selectedCustomer = customer; } if (selectedSkills != null) { skillsList = selectedSkills.Split(',').ToList(); } var model = from r in entities.Tbl_Jobs select r; if ((selectedCity == null || selectedCity == "") && (selectedCustomer == null || selectedCustomer == "") && (skillsList == null)) { model = from r in entities.Tbl_Jobs where r.Position == "dkjfldjlsdlfjljwljlwjrow" select r; } else if ((!(selectedCity == null || selectedCity == "")) && (selectedCustomer == null || selectedCustomer == "") && (skillsList == null)) { model = (from r in entities.Tbl_Jobs where r.City_Name == selectedCity select r); } else if ((selectedCity == null || selectedCity == "") && (!(selectedCustomer == null || selectedCustomer == "")) && (skillsList == null)) { model = (from r in entities.Tbl_Jobs where r.Customer == selectedCustomer select r); } else if ((selectedCity == null || selectedCity == "") && (selectedCustomer == null || selectedCustomer == "") && (!(skillsList == null))) { List <Tbl_Jobs> resultslist = new List <Tbl_Jobs>(); foreach (string item in skillsList) { model = (from r in entities.Tbl_Jobs where r.Required_Skills.Contains(item) select r).Distinct(); foreach (var entry in model) { resultslist.Add(entry); } } model = resultslist.Distinct().AsQueryable(); } else if ((!(selectedCity == null || selectedCity == "")) && (!(selectedCustomer == null || selectedCustomer == "")) && (skillsList == null)) { model = (from r in entities.Tbl_Jobs where r.Customer == selectedCustomer && r.City_Name == selectedCity select r); } else if ((!(selectedCity == null || selectedCity == "")) && (selectedCustomer == null || selectedCustomer == "") && (!(skillsList == null))) { List <Tbl_Jobs> resultslist = new List <Tbl_Jobs>(); foreach (string item in skillsList) { model = (from r in entities.Tbl_Jobs where r.City_Name == selectedCity && r.Required_Skills.Contains(item) select r).Distinct(); foreach (var entry in model) { resultslist.Add(entry); } } model = resultslist.Distinct().AsQueryable(); } else if ((!(selectedCity == null || selectedCity == "")) && (!(selectedCustomer == null || selectedCustomer == "")) && (!(skillsList == null))) { List <Tbl_Jobs> resultslist = new List <Tbl_Jobs>(); foreach (string item in skillsList) { model = (from r in entities.Tbl_Jobs where r.City_Name == selectedCity && r.Customer == selectedCustomer && r.Required_Skills.Contains(item) select r).Distinct(); foreach (var entry in model) { resultslist.Add(entry); } } model = resultslist.Distinct().AsQueryable(); } else if ((selectedCity == null || selectedCity == "") && (!(selectedCustomer == null || selectedCustomer == "")) && (!(skillsList == null))) { List <Tbl_Jobs> resultslist = new List <Tbl_Jobs>(); foreach (string item in skillsList) { model = (from r in entities.Tbl_Jobs where r.Customer == selectedCustomer && r.Required_Skills.Contains(item) select r).Distinct(); foreach (var entry in model) { resultslist.Add(entry); } } model = resultslist.Distinct().AsQueryable(); } else { model = from r in entities.Tbl_Jobs where r.Position == "dkjfldjlsdlfjljwljlwjrow" select r; } if (city != null && (city != "" || city != "Select One")) { ViewBag.LocationLabel = city; ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); } if (customer != null && (customer != "" || customer != "Select One")) { ViewBag.CustomerLabel = customer; ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); } if (page == null && city == null && customer == null) { ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); ViewBag.LocationLabel = "Select One"; ViewBag.CustomerLabel = "Select One"; } else if ((city == "" || city == "Select One")) { ViewBag.Location = (from r in entities.Tbl_Jobs select r.City_Name).Distinct(); ViewBag.LocationLabel = "Select One"; city = ""; } else if ((customer == "" || customer == "Select One")) { ViewBag.Customer = (from r in entities.Tbl_Jobs select r.Customer).Distinct(); ViewBag.CustomerLabel = "Select One"; customer = ""; } int pageSize = 10; int pageNum = (page ?? 1); LoggedInViewModel viewModel = new LoggedInViewModel(); ViewBag.skills = getSkillsList(null); viewModel.pagedList = model.OrderBy(p => p.Position).ToPagedList(pageNum, pageSize); return(PartialView("UserJobSearch", viewModel)); }