예제 #1
0
        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));
        }
예제 #2
0
        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"));
            }
        }