public ActionResult AddJob(JobVacancie newjob, List <int> Skills, string searchTitle)
        {
            JobTitle title = (from Titls in db.JobTitle
                              where Titls.JobName == searchTitle
                              select Titls).FirstOrDefault();

            if (title == null)
            {
                title = new JobTitle()
                {
                    JobName = searchTitle
                };
                newjob.JobTitle = title;
            }
            else
            {
                newjob.JobTitle = title;
            }
            ViewBag.lastLogin = CurrentUser.LastLogin;
            db.JobVacancie.Add(newjob);
            for (int i = 0; i < Skills.Count; i++)
            {
                Skill currentskill = db.Skill.Find(i);
                newjob.Skills.Add(currentskill);
            }

            db.SaveChanges();
            return(RedirectToAction("RecentJobs"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            JobVacancie jobVacancie = db.JobVacancie.Find(id);

            jobVacancie.State = State.Closed;
            //db.JobVacancie.Remove(jobVacancie);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult ApplayToJob(int JobVacancieID)
        {
            JobVacancie applayedVac = db.JobVacancie.Find(JobVacancieID);

            applayedVac.ApplayedUsers.Add(new ApplayedUsers()
            {
                UserId = User.Identity.GetUserId(), AppliedUserState = AppliedUserState.Applied, ApplicationUser = db.Users.Find(User.Identity.GetUserId())
            });
            db.SaveChanges();
            return(RedirectToAction("AppliedJobs", "UserProfile"));
        }
 public ActionResult Edit([Bind(Include = "JobVacancieID,ExpYears,JobTitleID,CompanyID,JobType")] JobVacancie jobVacancie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobVacancie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyID  = new SelectList(db.Company, "CompanyID", "CompanyName", jobVacancie.CompanyID);
     ViewBag.JobTitleID = new SelectList(db.JobTitle, "JobId", "JobName", jobVacancie.JobTitleID);
     return(View(jobVacancie));
 }
        public ActionResult editJobVac(JobVacancie newJobVac)
        {
            int         jobVacId = newJobVac.JobVacancieID;
            JobVacancie jobVac   = db.JobVacancie.Where(a => a.JobVacancieID == jobVacId).FirstOrDefault();

            jobVac.JobTitle.JobName = newJobVac.JobTitle.JobName;
            jobVac.ExpYears         = newJobVac.ExpYears;
            jobVac.JobType          = newJobVac.JobType;
            jobVac.Skills           = newJobVac.Skills;
            db.SaveChanges();
            return(PartialView("StaticAboutCompany", jobVac));
        }
        // GET: JobVacancies/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobVacancie jobVacancie = db.JobVacancie.Find(id);

            if (jobVacancie == null)
            {
                return(HttpNotFound());
            }
            return(View(jobVacancie));
        }
        public ActionResult Create([Bind(Include = "JobVacancieID,ExpYears,JobTitleID,CompanyID,JobType")] JobVacancie jobVacancie)
        {
            if (ModelState.IsValid)
            {
                jobVacancie.State = State.Active;
                jobVacancie.Date  = DateTime.Now;
                db.JobVacancie.Add(jobVacancie);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CompanyID  = new SelectList(db.Company, "CompanyID", "CompanyName", jobVacancie.CompanyID);
            ViewBag.JobTitleID = new SelectList(db.JobTitle, "JobId", "JobName", jobVacancie.JobTitleID);
            return(View(jobVacancie));
        }
        // GET: JobVacancies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobVacancie jobVacancie = db.JobVacancie.Find(id);

            if (jobVacancie == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CompanyID  = new SelectList(db.Company, "CompanyID", "CompanyName", jobVacancie.CompanyID);
            ViewBag.JobTitleID = new SelectList(db.JobTitle, "JobId", "JobName", jobVacancie.JobTitleID);
            return(View(jobVacancie));
        }
        public ActionResult ShowDetails(int JobVacancieID)
        {
            JobVacancie currentJob = db.JobVacancie.Find(JobVacancieID);
            bool        IsApplyed  = false;
            string      userid     = User.Identity.GetUserId();

            foreach (ApplayedUsers apuser in currentJob.ApplayedUsers)
            {
                if (apuser.UserId == userid)
                {
                    IsApplyed = true;
                }
            }
            ViewBag.IsApplyed = IsApplyed;
            return(View(currentJob));
        }
        public ActionResult editJobVac(int jobVacId)
        {
            JobVacancie     currentJobVac = db.JobVacancie.Where(a => a.JobVacancieID == jobVacId).FirstOrDefault();
            MultiSelectList allSkills     = new MultiSelectList(db.Skill, "Skill_Id", "Title", currentJobVac.Skills);

            ViewBag.allSkills = allSkills;
            List <Skill> currentSkills = currentJobVac.Skills.ToList();

            ViewBag.currentSkills = currentSkills;
            List <JobTitle> allJobTitles = db.JobTitle.ToList();

            ViewBag.allJobTitles = allJobTitles;


            return(PartialView(currentJobVac));
        }
        public ActionResult ChangeState(int id)
        {
            ViewBag.lastLogin = CurrentUser.LastLogin;
            JobVacancie currentJob = db.JobVacancie.Find(id);

            if (currentJob.State == State.Active)
            {
                currentJob.State = State.Closed;
                db.SaveChanges();
                return(RedirectToAction("RecentJobs"));
            }
            else
            {
                currentJob.State = State.Active;
                db.SaveChanges();
                return(RedirectToAction("ArchivedJobs"));
            }
        }
Beispiel #12
0
        public ActionResult JobDit(JobVacancie Vacancie)
        {
            JobVacancie vac = db.JobVacancie.Find(Vacancie.JobVacancieID);

            vac.Company  = db.Company.Find(Vacancie.CompanyID);
            vac.JobTitle = db.JobTitle.Find(Vacancie.JobTitleID);
            bool   isAppl = false;
            string userid = User.Identity.GetUserId();

            foreach (ApplayedUsers apuser in vac.ApplayedUsers)
            {
                if (apuser.UserId == userid)
                {
                    isAppl = true;
                }
            }
            ViewBag.isAppl = isAppl;
            return(View(vac));
        }
        public ActionResult AddJob()
        {
            ViewBag.lastLogin = CurrentUser.LastLogin;
            JobVacancie newjob      = new JobVacancie();
            Company     currentComp = db.Company.Find(CurrentUser.CompanyID);

            newjob.Date      = DateTime.Now;
            newjob.CompanyID = currentComp.CompanyID;
            newjob.Company   = currentComp;
            newjob.Company   = currentComp;

            SelectList jobTitles = new SelectList(db.JobTitle.ToList(), "JobId", "JobName");

            ViewBag.JobTitles = jobTitles;

            MultiSelectList jobSkills = new MultiSelectList(db.Skill.ToList(), "Skill_Id", "Title");

            ViewBag.JobSkills = jobSkills;

            return(View(newjob));
        }