private List<JobPost> LinkedInResultToJobPosts(LinkedInJobPost.LinkedInResult linkedinResult) { List<JobPost> results = new List<JobPost>(); foreach (LinkedInJobPost.LinkedInJobPost raw in linkedinResult.jobs.values) { //var loc = raw.locationDescription.Split(','); JobPost jobpost = new JobPost() { Company = raw.company.name, Description = raw.descriptionSnippet, Location = new Location(null, "U.S.", raw.locationDescription), URL = raw.siteJobUrl, SourceModule = source, DatePosted = new DateTime(raw.postingDate.year, raw.postingDate.month, raw.postingDate.day), JobTitle = raw.position.title, Salary = null }; results.Add(jobpost); } return results; }
public async Task <ActionResult <JobPostDTO> > PatchJobPost(long id, JobPostDTO postDTO) { JobPost post = DTOToJobPost(postDTO); if (id != post.JobPostId) { return(BadRequest()); } User user = await userManager.FindByIdAsync(User.Identity.Name); IList <string> roles = await userManager.GetRolesAsync(user); if (!roles.Contains(UserRoles.Admin)) { // check if the job post is owned by a companyt hat the recruiter is part of var query = from jobpost in _context.JobPosts join queryRecruiter in _context.Recruiters on jobpost.CompanyId equals queryRecruiter.CompanyId where jobpost.JobPostId == post.JobPostId && queryRecruiter.UserId == user.Id select jobpost; if (!query.Any()) { return(Unauthorized("You are not a recruiter for the currenet company specified in the job post")); } Recruiter recruiter = await _context.Recruiters.FindAsync(user.Id, post.CompanyId); if (recruiter == null) { return(Unauthorized("You are not a recruiter for the new company specified in the job post")); } } _context.Entry(post).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobPostExists(id)) { return(NotFound()); } else { throw; } } return(AcceptedAtAction("PatchJobPost", new { JobPostId = post.JobPostId }, postDTO)); }
public ActionResult Edit([Bind(Include = "JobPostId,JobTitle,Content,StateName,IsAwarded,CreatedDate,ModifiedDate,IsActive,EmployerId,FreelancerId")] JobPost jobPost) { if (ModelState.IsValid) { db.Entry(jobPost).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployerId = new SelectList(db.Employers, "EmployerId", "FirstName", jobPost.EmployerId); ViewBag.FreelancerId = new SelectList(db.Freelancers, "FreelancerId", "FirstName", jobPost.FreelancerId); return(View(jobPost)); }
public ActionResult JobPostDelete(int id, JobPost jpos) { try { objJobPost.commitDelete(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult PostJob(JobPost jobPost) { if (ModelState.IsValid) { jobPost.ApplcationUserID = User.Identity.GetUserId(); db.JobPosts.Add(jobPost); db.SaveChanges(); ViewBag.Message = "You Have successfully Uploaded job Vacancy"; return(View("Success")); } return(View()); }
public ActionResult Edit([Bind(Include = "Id,EmployerId,RoundId,CompanyAddress,Position,Posted,Description")] JobPost jobPost) { if (ModelState.IsValid) { db.Entry(jobPost).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployerId = new SelectList(db.Employer, "Id", "CompanyName", jobPost.EmployerId); ViewBag.RoundId = new SelectList(db.Rounds, "Id", "Session", jobPost.RoundId); return(View(jobPost)); }
public ActionResult Create([Bind(Include = "Id,Title,EmployerId")] JobPost jobPost) { if (ModelState.IsValid) { db.JobPosts.Add(jobPost); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployerId = new SelectList(db.Employers, "Id", "FullName", jobPost.EmployerId); return(View(jobPost)); }
public async Task <IActionResult> PostJobPost([FromBody] JobPost jobPost) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.JobPosts.Add(jobPost); await _context.SaveChangesAsync(); return(CreatedAtAction("GetJobPost", new { id = jobPost.Id }, jobPost)); }
public void Save(JobPost jobPost) { if (jobPost == null) { throw new ArgumentNullException("jobPost"); } if (!File.Exists(filePath)) { return; } var existingJobs = XElement.Load(filePath); XElement existingJob = null; Guid id; if (!jobPost.Id.Equals(Guid.Empty)) { id = jobPost.Id; existingJob = existingJobs.Elements(JobPost.JOB).SingleOrDefault(x => (Guid)x.Element(JobPost.ID) == id); } else { id = Guid.NewGuid(); } var newJob = new XElement(JobPost.JOB, new XElement(JobPost.ID, id), new XElement(JobPost.ROLE, jobPost.Role), new XElement(JobPost.DESCRIPTION, jobPost.Description), new XElement(JobPost.LOCATION, jobPost.Location), new XElement(JobPost.JOBTYPE, jobPost.JobType), new XElement(JobPost.PAYMENTRATE, jobPost.PaymentRate), new XElement(JobPost.CONTACTNAME, jobPost.ContactName), new XElement(JobPost.CONTACTPHONE, jobPost.ContactPhone), new XElement(JobPost.MODIFIEDDATE, DateTime.Now) ); if (existingJob != null) { existingJob.ReplaceWith(newJob); existingJobs.Save(filePath); } else { var jobs = new XElement(JobPost.ROOT); jobs.Add(existingJobs.Elements(JobPost.JOB)); jobs.Add(newJob); jobs.Save(filePath); } }
private static JobPostDTO JobPostToDTO(JobPost post) { post.ClosingDate = post.ClosingDate.Date.AddSeconds(86399); return(new JobPostDTO { JobPostId = post.JobPostId, CompanyId = post.CompanyId, Name = post.Name, Description = post.Description, ClosingDate = post.ClosingDate, Salary = post.Salary }); }
public ActionResult Edit([Bind(Include = "jobPostId,categoryId,areaid,companyId,jobTitleId,type,location,postedDate,skillsReq,educationReq,description,contactEmail,salary,isAvailable")] JobPost jobPost) { if (ModelState.IsValid) { db.Entry(jobPost).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.areaid = new SelectList(db.Areas, "area_id", "area_name", jobPost.areaid); ViewBag.categoryId = new SelectList(db.Categories, "category_id", "category_name", jobPost.categoryId); ViewBag.jobTitleId = new SelectList(db.JobTitles, "jobtitleId", "jobtitleName", jobPost.jobTitleId); return View(jobPost); }
// GET: Recruiter/JobPosts/Details/5 public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } JobPost jobPost = db.JobPosts.Find(id); if (jobPost == null) { return HttpNotFound(); } return View(jobPost); }
public void showJobPostDetails(DataVO.JobPost data) { this.mData = data; this.lblJobTitle.Text = data.info.title; this.lblPayment.Text = data.info.payment.ToString(); this.lblAddress.Text = data.info.area; this.lblDate.Text = data.info.date; this.lblTime.Text = data.info.startTime; this.lblDuration.Text = data.info.duration.ToString(); this.lblDescription.Text = data.info.description; this.lblJobStatus.Text = data.jobStatus; this.lblAppliedWorkers.Text = data.appliedUsers.Count.ToString(); }
public IActionResult Update(string id, JobPost jobPost) { var job = _jobPostService.Get(id); if (job == null) { return(NotFound()); } _jobPostService.Update(id, jobPost); return(NoContent()); }
// GET: JobPosts/Create public ActionResult Create() { ViewBag.EmployerId = new SelectList(db.Employers, "Id", "ApplicationUserId"); ViewBag.EmploymentTypeId = new SelectList(db.EmploymentTypes, "Id", "Name"); ViewBag.IndustryId = new SelectList(db.Industries.Include(x => x.Category).ToList(), "Id", "Name", "Category.Name", null, null); var model = new JobPost() { LocationSameAsEmployer = true }; return(View(model)); }
public async Task <IActionResult> Delete(int id) { JobPost jobPost = this.jobPostsService.GetJobPost(id); if (jobPost == null || !await this.UserPermission(jobPost.EmployerId)) { return(this.NotFound()); } await this.jobPostsService.DeleteAsync(jobPost); return(this.Redirect("/")); }
public async Task <IActionResult> Create([FromBody] JobPost model) { if (string.IsNullOrWhiteSpace(model.Content)) { return(Json(false)); } model.PostBy = AutoMapper.Mapper.Map <Author>(_currentProcess.CurrentAccount.Account); model.PersonId = _currentProcess.CurrentAccount.Account.PersonId; model.PostingAsType = ActionAsType.Person; //var result = await _httpClient.SendRequestAsync<ResponseActionJsonModel>(Request, _clientConfig, $"/JobPosts/create", HttpMethod.Post, model); //return ToResponse(result); return(await PostAsync(Request, "/JobPosts/create", null, model)); }
public HttpResponseMessage PostNewPosterUser(PosterUserModel jinderPosterUser) { JinderDBEntities dbContext = new JinderDBEntities(); var usersTable = dbContext.JinderUsers; var PosterTable = dbContext.JobPosts; HttpResponseMessage message = new HttpResponseMessage(); JinderUser jinderuser = (from user in usersTable where user.username == jinderPosterUser.username select user).FirstOrDefault <JinderUser>(); if (jinderuser != null) { message.StatusCode = HttpStatusCode.Conflict; return(message); } else { JinderUser user = new JinderUser(); user.FullName = jinderPosterUser.FullName; user.DateOfBirth = jinderPosterUser.DateOfBirth; user.Gender = jinderPosterUser.Gender; user.Address = jinderPosterUser.Address; user.UserType = jinderPosterUser.UserType; user.username = jinderPosterUser.username; user.password = jinderPosterUser.password; usersTable.Add(user); dbContext.SaveChanges(); JobPost posterUser = new JobPost(); posterUser.PosterId = user.JinderUserId; posterUser.Location = jinderPosterUser.Location; posterUser.JobDescription = jinderPosterUser.JobDescription; posterUser.RequiredSkills = jinderPosterUser.RequiredSkills; posterUser.SalaryRange = jinderPosterUser.SalaryRange; posterUser.OperationHours = jinderPosterUser.OperationHours; PosterTable.Add(posterUser); dbContext.SaveChanges(); message.StatusCode = HttpStatusCode.OK; return(message); } }
public void SetBookmarkState(int jobPostId, bool isBookmarked) { using (var dbContext = new JobPortalDbContext()) { var jobPost = new JobPost { Id = jobPostId, IsBookmarked = isBookmarked }; dbContext.JobPosts.Attach(jobPost); dbContext.Entry <JobPost>(jobPost).Property(jp => jp.IsBookmarked).IsModified = true; dbContext.SaveChanges(); } }
// GET: JobPosts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobPost jobPost = db.JobPosts.Find(id); if (jobPost == null) { return(HttpNotFound()); } return(View(jobPost)); }
public void GivenIAmOnJobPostPage() { PerformLoginAsRecruiterOrEmployer(); // navigate to job post page CurrentPage = GetInstance <JobPostPage>(Driver); CurrentPage.As <JobPostPage>().Open(); // load any data here ExcelUtil.SetDataSource("Job.xlsx"); // would be nice to perhaps make use of tags to programmatically grab the data without having to // specify a specific row to grab from the spreadsheet jobPost = ObjectFactory.CreateInstance <JobPost>(ExcelUtil.DataSet.SelectSheet("ADD").GetRowByKey("Valid")); }
public IActionResult RemovePayment(int jobId, PaymentModel payment) { IJobDAO jobDAO = new JobDAO(_connection); JobPost post = jobDAO.FindById(jobId); if (post == null) { return(NotFound(new ErrorMessageModel("Post não encontrado!"))); } jobDAO.RemovePayment(jobId, payment); return(Ok(new SuccessMessageModel("Apagado!"))); }
public async Task <IActionResult> Create([Bind("Id,Name,Desp,Position,Skill,Vacancy,Nature,Experience,Requirements,Salary,AddedDate,Address,LastDate")] JobPost jobPost) { if (ModelState.IsValid) { jobPost.AddedDate = DateTime.Now; _context.Add(jobPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(jobPost)); }
// GET: JobPosts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobPost jobPost = db.JobPosts.Include(X => X.EmploymentType).Include(x => x.Industry).SingleOrDefault(x => x.Id == id); if (jobPost == null) { return(HttpNotFound()); } return(View(jobPost)); }
public IActionResult Edit(JobPost jobPost) { if (ModelState.IsValid) { repository.SaveJobPost(jobPost); TempData["message"] = $"The job post for {jobPost.Title} has been saved."; return(RedirectToAction(nameof(Index))); //return View(jobPost); } else { return(View(jobPost)); } }
public void JobPostObjFromCtorWithKeywordsTest() { const string title = "Best Job"; const string body = ".Net developer is needed"; var jobPost = new JobPost(title, body); jobPost.Keywords.Add("c#"); jobPost.Keywords.Add("dotnet core"); Assert.Equal(title.ToLower(), jobPost.Header); Assert.Equal(body.ToLower(), jobPost.Body); Assert.True(jobPost.Keywords.Count == 2); }
public IActionResult Create(int postId, string slug) { ReportViewModel viewModel = new ReportViewModel(); JobPost jobPost = this.jobPostsService.GetJobPost(postId); if (jobPost == null) { return(this.NotFound()); } viewModel.PostId = jobPost.Id; viewModel.PostTitle = jobPost.Title; return(this.View(viewModel)); }
public async Task <IActionResult> Create(JobPost jobPost) { jobPost.PostDate = DateTime.Now; if (ModelState.IsValid) { unit.JobPosts.Add(jobPost); await unit.SaveAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["DeptId"] = new SelectList(_context.Departments, "Id", "Name", jobPost.DeptId); ViewData["DeptId"] = new SelectList(unit.Departments.GetAllIEnumerable(), "Id", "Name", jobPost.DeptId); return(View(jobPost)); }
public async Task EditAsync(int id, string title, string description, string city, string country, string tags) { JobPost jobPost = this.GetJobPost(id); jobPost.Title = title; jobPost.Description = description; jobPost.City = city; jobPost.Country = country; this.jobPostsRepository.Update(jobPost); await this.jobPostsRepository.SaveChangesAsync(); await this.tagService.UpdateTagAsync(id, tags); }
public ActionResult <Payment> AddPayment(int jobId, PaymentModel[] payment) { IJobDAO jobDAO = new JobDAO(_connection); JobPost post = jobDAO.FindById(jobId); if (post == null) { return(NotFound(new ErrorMessageModel("Post não encontrado!"))); } jobDAO.AddPayment(jobId, payment); return(Ok(payment)); }
public IHttpActionResult DeleteJobPost(int id) { JobPost jobPost = db.JobPosts.Find(id); if (jobPost == null) { return(NotFound()); } db.JobPosts.Remove(jobPost); db.SaveChanges(); return(Ok(jobPost)); }
public List<JobPost> GetJobs( FilterBag filters , int page , int resultsPerPage ) { List<JobPost> jobsToReturn = new List<JobPost>( ); if (filters.IsEmpty()) { return jobsToReturn; } string request = builder.BuildQuery( filters , page , resultsPerPage ); XDocument doc = XDocument.Load( request ); IEnumerable<XElement> results = doc.Descendants( "ResponseJobSearch" ).Single( ).Descendants( "Results" ).Single( ).Descendants( "JobSearchResult" ); foreach ( var jobPost in results ) { JobPost post = new JobPost( ); post.URL = jobPost.Element( "JobDetailsURL" ).Value; post.SourceModule =source; post.DatePosted = DateTime.Parse( jobPost.Element( "PostedDate" ).Value ); post.JobTitle = jobPost.Element( "JobTitle" ).Value; //this field is returned as "MN - Plymouth", so split by values string[] location = jobPost.Element( "Location" ).Value.Split( new char[] { '-' } ); post.Location = new Location { State= location[0].Trim( ) , City= location[1].Trim( ) , ZipCode=null }; //if the company name is empty, fill with city and state (there are some posts with an empty company name) post.Company = jobPost.Element( "Company" ).Value==""?location[1]+" , "+location[0]:jobPost.Element( "Company" ).Value; post.Description = jobPost.Element( "DescriptionTeaser" ).Value; post.FieldOfStudy = null; post.Salary = jobPost.Element( "Pay" ).Value; jobsToReturn.Add( post ); } return jobsToReturn; }
public List<JobPost> GetJobs( FilterBag filters , int page , int resultsPerPage ) { List<JobPost> jobsToReturn = new List<JobPost>( ); ; string request = builder.BuildQuery( filters , page , resultsPerPage ); XDocument doc = XDocument.Load( request ); IEnumerable<XElement> results = doc.Descendants( "result" ).Single( ).Descendants( "resultItemList" ).Single( ).Descendants( "resultItem" ); foreach ( var jobPost in results ) { JobPost post = new JobPost( ); post.Company = jobPost.Element( "company" ).Value; post.URL = jobPost.Element( "detailUrl" ).Value; post.SourceModule =source; post.DatePosted = DateTime.Parse( jobPost.Element( "date" ).Value ); post.JobTitle = jobPost.Element( "jobTitle" ).Value; //this field is returned as "San Ramon, CA", so split by values string[] location = jobPost.Element( "location" ).Value.Split( new char[] { ',' } ); post.Location = new Location { State= location[1].Trim( ) , City= location[0].Trim( ) , ZipCode=null }; //Dice_Module doesn't even give a teaser...so I'm faking one. post.Description = jobPost.Element( "company" ).Value +" is looking for a " +jobPost.Element( "jobTitle" ).Value; post.FieldOfStudy = null; post.Salary = null; jobsToReturn.Add( post ); } return jobsToReturn; }
/// <summary> /// Asyncronously grap a set of job postings based off of the given filters and page number. /// </summary> /// <param name="filters">The filters that the module should use to query</param> /// <param name="page">What page number of results to grab</param> /// <returns>The job postings</returns> public List<JobPost> GetJobs( FilterBag filters , int page , int resultsPerPage ) { List<JobPost> jobsToReturn = new List<JobPost>( ); //build the URI query string request = BuildQuery( filters , page , resultsPerPage ); //get the raw JSON data WebClient wc = new WebClient( ); JArray JobPosts = JArray.Parse( wc.DownloadString( request ) ); //Process It into JobPost objects foreach ( var jobPost in JobPosts ) { JobPost post = new JobPost( ); post.URL = "https://arizona-csm.symplicity.com/sso/students/index.php?mode=form&id="+jobPost["SymplicityJobID"]+"&s=jobs&ss=jobs"; post.SourceModule =source; post.DatePosted = DateTime.Parse( jobPost["PostingDate"].ToString( ) ); post.JobTitle = jobPost["JobTitle"].ToString( ); string[] location = jobPost["Location"].ToString( ).Split( new char[] { ',' } ); post.Location = new Location { State= location[1].Trim( ) , City= location[0].Trim( ) , ZipCode=null }; post.Company = jobPost["Employer"].ToString( ); post.Description = jobPost["Description"].ToString( ); post.FieldOfStudy = null; post.Salary = jobPost["SalaryLevel"].ToString( ); jobsToReturn.Add( post ); } return jobsToReturn; }
public static JobPost CreateJobPost(long id) { JobPost jobPost = new JobPost(); jobPost.ID = id; return jobPost; }
public void AddToJobPost(JobPost jobPost) { base.AddObject("JobPost", jobPost); }
/// <summary> /// Asyncronously grap a set of job postings based off of the given filters and page number. /// https://jobs.github.com/api /// </summary> /// <param name="filters">The filters that the module should use to query</param> /// <param name="page">What page number of results to grab</param> /// <returns>The job postings</returns> public List<JobPost> GetJobs( FilterBag filters , int page , int resultsPerPage ) { resultsPerPage = ( ( resultsPerPage<=50?resultsPerPage:50 )>=1?( resultsPerPage<=50?resultsPerPage:50 ):1 ); int startIndex = ( resultsPerPage*page )<50? ( resultsPerPage*page ):49; //int stopIndex = startIndex + resultsPerPage-1 <=50? startIndex + resultsPerPage-1 :50; List<JobPost> jobsToReturn = new List<JobPost>( ); //build the URI query string request = BuildQuery( filters , page , resultsPerPage ); //get the raw JSON data WebClient wc = new WebClient( ); JArray JobPosts = JArray.Parse( wc.DownloadString( request ) ); //Process It into JobPost objects foreach (JToken jobPost in JobPosts) { try { JobPost post = new JobPost( ); post.SourceModule =source; //url post.URL = jobPost["url"].ToString( ); //parse date into proper format String date = jobPost["created_at"].ToString().Replace("UTC ", ""); post.DatePosted = DateTime.ParseExact(date, "ddd MMM dd HH:mm:ss yyyy", null); //job title post.JobTitle = jobPost["title"].ToString( ); //location String[] location = jobPost["location"].ToString( ).Split( new char[] { ',' } ); if ( location.Length>=2 ) post.Location = new Location { State= location[1].Trim( ) , City= location[0].Trim( ) , ZipCode=null }; else if ( location.Length==1 ) { post.Location = new Location { City=location[0], State=null,ZipCode=null }; } else post.Location = new Location { City=null , State=null , ZipCode=null }; //company post.Company = jobPost["company"].ToString( ); string temp =jobPost["description"].ToString( ); //description post.Description = temp.Substring( 0 , temp.Length<350?temp.Length:350 )+"..."; post.FieldOfStudy = null; post.Salary = null; jobsToReturn.Add( post ); } catch ( Exception ex ) { System.Diagnostics.Debug.WriteLine( "GitHub Module:\t" +ex.Message ); } } return jobsToReturn.Skip( startIndex ).Take( resultsPerPage ).ToList<JobPost>( ); }
/// <summary> /// Takes an object consisting of raw, Indeed-specific results and parses into a /// jobSalt-standardized data object. If a higher page is requested than Indeed has results, /// (e.g. Indeed has 1000 results and a page starting at result 1001 is requested), then /// this method will return an empty result list. /// </summary> /// <param name="iResult"></param> /// <param name="startpost"></param> /// <returns></returns> private List<JobPost> IndeedResultToJobPosts(IndeedResult iResult, int startpost) { List<JobPost> results = new List<JobPost>(); // If we try and get results even after Indeed has shown all it can, // Indeed will just return the last 10 or so. To avoid that, short circuit // once we've run out of possible posts if (startpost >= iResult.TotalResults) { return results; } foreach( IndeedJobPost raw in iResult.Results){ JobPost jobpost = new JobPost(){ URL = raw.URL, SourceModule = source, DatePosted = raw.Date, Company = raw.Company, JobTitle = raw.JobTitle, Location = new Location( raw.State, raw.City, null ), Salary = null, Description = raw.Snippet, FieldOfStudy = null }; results.Add(jobpost); } return results; }