Ejemplo n.º 1
0
        public async Task <ActionResult> Apply(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Job job = await bll.GetJobById(id.Value);

            if (job == null)
            {
                return(HttpNotFound());
            }

            //check if the user has already applied
            var jobSeekerUser = (JobSeekerUser)(await UserManager.FindByIdAsync(User.Identity.GetUserId()));

            using (JobSeekerBLL jsbll = new BLL.JobSeekerBLL())
            {
                var application = await jsbll.GetApplication(jobSeekerUser.JobSeekerID.Value, job.ID);

                if (application == null)
                {
                    return(View(job));
                }
            }
            //todo how to tell the user that he has already applied.
            return(RedirectToAction("Index"));
            //todo any qualifcation checks(like is the job invitationonly
            //does the user have enough experience for application set by the company, etc.)
            //needed for a user to apply should be done here
        }