public int UpdateJob(JobOpenings job) { Dictionary <string, object> data = new Dictionary <string, object>(); data["JobID"] = job.JobID; data["MinExperience"] = job.MinExperience; data["JobDescription"] = job.JobDescription; //data["DatePosted"] = DateTime.Now.ToString("yyyy-MM-dd"); data["ExpectedStartDate"] = job.ExpectedStartDate; data["DesignationID"] = GetDesignationIdbyTitle(job.Designation); data["DepartmentID"] = GetDepartmentIdbyTitle(job.Department); using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44380/api/"); var responseTask = client.PostAsJsonAsync("NucesJob/UpdateJobOpening", data); responseTask.Wait(); var result = responseTask.Result; if (result.StatusCode == HttpStatusCode.OK) { return(1); } else { return(0); } } }
public JobOpenings GetJobById(int id) { List <JobOpenings> AllJobOpenings = new List <JobOpenings>(); using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44380/api/"); var responseTask = client.GetAsync("NucesJob/GetOpeningsById/" + id.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <JobOpenings[]>(); readTask.Wait(); var allopenings = readTask.Result; foreach (var item in allopenings) { item.Designation = GetDesignationByID(item.DesignationID); item.Department = GetDepartmentByID(item.DepartmentID); AllJobOpenings.Add(item); } } } JobOpenings SingleJob = AllJobOpenings[0]; return(SingleJob); }
public ActionResult JobOpeningsByRole(string role) { Assignment1_Client.SayHello.SayHelloClient client = new Assignment1_Client.SayHello.SayHelloClient("BasicHttpBinding_ISayHello"); JobOpenings openings = new JobOpenings(); openings.role = role; openings.opening = client.OpeningJobsByRole(role); return(View(openings)); }
// GET: JobOpenings/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobOpenings jobOpenings = db.JobOpenings.Find(id); if (jobOpenings == null) { return(HttpNotFound()); } return(View(jobOpenings)); }
public ActionResult DeleteConfirmed(int id) { if (!(KECAuthenticate.isAuthenticated) || (KECAuthenticate.IsAdmin == false) && (KECAuthenticate.isJobsEditor == false)) { return(RedirectToAction("NotAuthorised", "Home")); } JobOpenings jobOpenings = db.JobOpenings.Find(id); db.JobOpenings.Remove(jobOpenings); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: JobOpenings/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobOpenings jobOpenings = db.JobOpenings.Find(id); if (jobOpenings == null) { return(HttpNotFound()); } ViewBag.jobExperienceID = new SelectList(db.Lookup_Experiences, "ExperienceID", "ExperienceShort_Description", jobOpenings.jobExperienceID); return(View(jobOpenings)); }
public ActionResult JobOpenings() { Assignment1_Client.SayHello.SayHelloClient client = new Assignment1_Client.SayHello.SayHelloClient("BasicHttpBinding_ISayHello"); List <JobOpenings> openings = new List <JobOpenings>(); var response = client.OpeningJobs(); foreach (var item in response) { JobOpenings opening = new JobOpenings(); opening.opening = item.Value; opening.role = item.Key; openings.Add(opening); } return(View(openings)); }
public ActionResult Edit([Bind(Include = "JobOpenID,jobExperienceID,JobID,Company,jobPosition,Qualification,Locations,ContactDetails,ValidFrom,ValidTo,Keywords")] JobOpenings jobOpenings) { if (!(KECAuthenticate.isAuthenticated) || (KECAuthenticate.IsAdmin == false) && (KECAuthenticate.isJobsEditor == false)) { return(RedirectToAction("NotAuthorised", "Home")); } if (ModelState.IsValid) { db.Entry(jobOpenings).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.jobExperienceID = new SelectList(db.Lookup_Experiences, "ExperienceID", "ExperienceShort_Description", jobOpenings.jobExperienceID); return(View(jobOpenings)); }
// GET: JobOpenings/Delete/5 public ActionResult Delete(int?id) { if (!(KECAuthenticate.isAuthenticated) || (KECAuthenticate.IsAdmin == false) && (KECAuthenticate.isJobsEditor == false)) { return(RedirectToAction("NotAuthorised", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobOpenings jobOpenings = db.JobOpenings.Find(id); if (jobOpenings == null) { return(HttpNotFound()); } return(View(jobOpenings)); }
public ActionResult Create([Bind(Include = "JobOpenID,jobExperienceID,JobID,Company,jobPosition,Qualification,Locations,ContactDetails,ValidFrom,ValidTo,Keywords,JobFile")] JobOpenings jobOpenings) { if (!(KECAuthenticate.isAuthenticated) || (KECAuthenticate.IsAdmin == false) && (KECAuthenticate.isJobsEditor == false)) { return(RedirectToAction("NotAuthorised", "Home")); } var strAppPath = System.Web.HttpRuntime.AppDomainAppVirtualPath.ToString(); if (strAppPath == "/") { strAppPath = string.Empty; } if (ModelState.IsValid) { db.JobOpenings.Add(jobOpenings); db.SaveChanges(); //return RedirectToAction("Index"); } foreach (string upload in Request.Files) { //c:\users\narsa\documents\visual studio 2015\Projects\KECJobs\KECJobs\Registrations\Uploads\ //byte[] fileData = new byte[Request.Files[upload].InputStream.Length]; var x = Server.MapPath(strAppPath + ConfigurationManager.AppSettings["OpeningUploads"]) + "\\" + jobOpenings.JobOpenID.ToString() + "_" + Request.Files[upload].FileName; Request.Files[upload].SaveAs(x); jobOpenings.JobFile = jobOpenings.JobOpenID.ToString() + "_" + Request.Files[upload].FileName; db.SaveChanges(); } ViewBag.jobExperienceID = new SelectList(db.Lookup_Experiences, "ExperienceID", "ExperienceShort_Description", jobOpenings.jobExperienceID); return(View(jobOpenings)); }