/// <summary>Snippet for DeleteJob</summary> public void DeleteJob() { // Snippet: DeleteJob(JobNameOneof,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) JobNameOneof name = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")); // Make the request jobServiceClient.DeleteJob(name); // End snippet }
/// <summary>Snippet for DeleteJob</summary> public void DeleteJob() { // Snippet: DeleteJob(string,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) string formattedName = new JobName("[PROJECT]", "[JOB]").ToString(); // Make the request jobServiceClient.DeleteJob(formattedName); // End snippet }
// [START job_search_delete_job_beta] public static object DeleteJob(string projectId, string tenantId, string jobId) { JobServiceClient jobServiceClient = JobServiceClient.Create(); JobName name = new JobName(projectId, tenantId, jobId); DeleteJobRequest request = new DeleteJobRequest { JobNameOneof = JobNameOneof.From(name) }; jobServiceClient.DeleteJob(request); Console.WriteLine("Deleted Job."); return(0); }
bool DeleteJob(string jobID) { using (JobServiceClient jobService = new JobServiceClient()) { string address = string.Format("{0}/JobService.svc", _wcfAddress); jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); //Delete the selected job using the DeleteJob WCF Service DeleteJobRequest deleteJobRequest = new DeleteJobRequest(); deleteJobRequest.ID = jobID; DeleteJobResponse deleteJobResponse = jobService.DeleteJob(deleteJobRequest); return(deleteJobResponse.IsDeleted); } }
/// <summary>Snippet for DeleteJob</summary> public void DeleteJob_RequestObject() { // Snippet: DeleteJob(DeleteJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) DeleteJobRequest request = new DeleteJobRequest { JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")), }; // Make the request jobServiceClient.DeleteJob(request); // End snippet }
private void _tsDeleteJob_Click(object sender, EventArgs e) { string address = string.Format("{0}/JobService.svc", _userHost ? _hostAddress : _IISAddress); try { using (JobServiceClient jobService = new JobServiceClient()) { jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); foreach (DataGridViewRow rowToDelete in _dgDBJobs.SelectedRows) { //Remove from database DeleteJobRequest deleteRequest = new DeleteJobRequest(); deleteRequest.ID = rowToDelete.Cells[JobProcessorConstants.Database.GuidColumn].Value.ToString(); DeleteJobResponse deleteJobResponse = jobService.DeleteJob(deleteRequest); if (deleteJobResponse.IsDeleted) { //Remove from grid. Check if job stil exist in case it was removed by a refresh if (_dgDBJobs.Rows.IndexOf(rowToDelete) != -1) { _dgDBJobs.Rows.Remove(rowToDelete); } } else { MessageBox.Show("Error removing job"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } UpdateRowCount(); }
public async Task<ActionResult> DeleteConfirmed(int id) { using (var client = new JobServiceClient()) { await client.DeleteJob(id); } return RedirectToAction("Index"); }
public async Task<ActionResult> DeleteConfirmed(int id) { using (var client = new JobServiceClient()) { await client.DeleteJob(id); Job deletedJob = await _client.GetJobById(id); if (deletedJob == null) { TempData["Message"] = "Job was successfully deleted."; } else { TempData["Message"] = "Job was not deleted."; } } return RedirectToAction("Index"); }
public async Task<ActionResult> Edit([Bind(Include = "Position,Description,FullPartTime,SalaryRange")] Job job) { if (ModelState.IsValid) { using (var client = new JobServiceClient()) { await client.DeleteJob(job.JobId); } using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://aimadminstrativeservice.cloudapp.net/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // HTTP GET string request = "api/Job"; HttpResponseMessage response = await client.PostAsJsonAsync(request, job); if (response.IsSuccessStatusCode) { await response.Content.ReadAsAsync<Job>(); } } TempData["Message"] = "Job " + job.Position + " was successfully updated."; return RedirectToAction("Index"); } return View(job); }