public async Task <IActionResult> CreateAsync() { var listOfProperties = await _unitOfWork.Jobs.GetListsOfPropertiesAsync(); var jobFormInfo = new JobFormViewModel { Job = new Job(), Categories = listOfProperties.Categories, WorkingHours = listOfProperties.WorkingHours, TypesOfContract = listOfProperties.TypesOfContract }; return(View("JobForm", jobFormInfo)); }
// Hiring Manager can add new job //POST: Jobs/New public ActionResult New() { if (Session["userPrivilege"] == null || Int32.Parse(Session["userPrivilege"].ToString()) != 2) { return(RedirectToAction("SignIn", "UserAccount")); } var degrees = _context.Degrees.ToList(); var viewModel = new JobFormViewModel { Degrees = degrees }; return(View("JobForm", viewModel)); }
public ActionResult Create(int id) { var userId = User.Identity.GetUserId(); if (_context.Memberships.FirstOrDefault(m => m.MemberId == userId && m.OrganizationId == id) == null) { return(new HttpUnauthorizedResult()); } var viewModel = new JobFormViewModel() { OrganizationId = id }; return(View(viewModel)); }
public async Task <IActionResult> DeleteAsync(long id) { var jobInDb = await _unitOfWork.Jobs.GetJobWithAllPropertiesAsync(id); var listOfProperties = await _unitOfWork.Jobs.GetListsOfPropertiesAsync(); var jobFormInfo = new JobFormViewModel { Job = jobInDb, Categories = listOfProperties.Categories, WorkingHours = listOfProperties.WorkingHours, TypesOfContract = listOfProperties.TypesOfContract }; return(View("DeleteJobForm", jobFormInfo)); }
public ActionResult Create(JobFormViewModel viewModel) { if (!ModelState.IsValid) { return(View("Create", viewModel)); } var job = new Job() { Reference = viewModel.Reference, OrganizationId = viewModel.OrganizationId }; _context.Jobs.Add(job); _context.SaveChanges(); return(RedirectToAction("Details", "Organization", new { id = viewModel.OrganizationId })); }
//GET: /Admin/UpdateJob?id=id public ActionResult UpdateJob(Guid id, string property = "") { if (property == "DeadLine") { //instantly End Job Application _jobRepo.EndJobApplication(id); return(RedirectToAction("GetJobs")); } else { var job = _jobRepo.ReadItem(id); JobFormViewModel model = Mapper.Map <Job, JobFormViewModel>(job); model.Id = job.Id.ToString(); return(View("JobForm", model)); } }
// GET: api/JobForm public List <JobFormViewModel> GetJobForm() { var JobFormList = db.JobForm.ToList(); List <JobFormViewModel> JobFormViewModelList = new List <JobFormViewModel>(); foreach (var item in JobFormList) { JobFormViewModel JobFormViewModel = new JobFormViewModel(); Mapper.CreateMap <JobForm, JobFormViewModel>(); JobFormViewModel = Mapper.Map <JobForm, JobFormViewModel>(item); JobFormViewModel.JobName = item.Jobs?.JobTitle; JobFormViewModelList.Add(JobFormViewModel); } return(JobFormViewModelList); }
public ActionResult ApplyForJob(JobFormViewModel jobform, int id) { var job = _context.JobApplicationPost.Single(j => j.Id == id); var viewmodel = new JobForm { TalentedUserId = User.Identity.GetUserId(), JobPostId = job.Id, FirstName = jobform.FirstName, LastName = jobform.LastName, Email = jobform.Email, Question1 = jobform.Question1, PhoneNumber = jobform.PhoneNumber, Question2 = jobform.Question2 }; _context.JobForm.Add(viewmodel); _context.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult Edit(Guid id) { var userId = User.Identity.GetUserId(); var job = _unitOfWork.GeneralRepository.GetJobForEdit(userId, id); var viewModel = new JobFormViewModel { State = _unitOfWork.GeneralRepository.GetStateList(), City = job.City, Description = job.Description, Designation = job.Designation, JobCategory = job.JobCategory, JobTitle = job.JobTitle, Skill = job.Skill, State_Id = job.State_Id, TypeOfJob_Id = job.TypeOfJob_ID, ValidTill = job.ValidTill, Heading = "Edit Job", Action = "Update" }; return(View("AddJob", viewModel)); }
public ActionResult AddJob(JobFormViewModel viewModel) { var postedJob = new PostedJob { Id = Guid.NewGuid(), UserId = User.Identity.GetUserId(), JobTitle = viewModel.JobTitle, Description = viewModel.Description, Designation = viewModel.Designation, State_Id = viewModel.State_Id, City = viewModel.City, //JobCategory = viewModel.JobCategory, Skill = viewModel.Skill, TypeOfJob_ID = viewModel.TypeOfJob_Id, ValidTill = viewModel.ValidTill, IsCanceled = false, experience = viewModel.experience, salary = viewModel.salary }; var i = _unitOfWork.GeneralRepository.SaveJob(postedJob); return(RedirectToAction("DashBoard", "Recruiter")); }
public int UpdateJob(JobFormViewModel viewModel, string userId) { try { var job = ApplicationDbContext.PostedJobs .Single(j => j.Id == viewModel.Id && j.UserId == userId); job.City = viewModel.City; job.Description = viewModel.Description; job.Designation = viewModel.Designation; job.JobCategory = viewModel.JobCategory; job.JobTitle = viewModel.JobTitle; job.Skill = viewModel.Skill; job.State_Id = viewModel.State_Id; job.TypeOfJob_ID = viewModel.TypeOfJob_Id; job.ValidTill = viewModel.ValidTill; ApplicationDbContext.SaveChanges(); return(1); } catch (Exception ex) { return(0); } }
public IHttpActionResult PutJobFormViewModel(int id, JobFormViewModel jobFormViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jobFormViewModel.Id) { return(BadRequest()); } JobForm JobForm = new JobForm(); Mapper.CreateMap <JobFormViewModel, JobForm>(); JobForm = Mapper.Map <JobFormViewModel, JobForm>(jobFormViewModel); db.Entry(JobForm).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JobFormExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }