public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Job = await _context.Job.FirstOrDefaultAsync(m => m.JobId == id); if (Job == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Job = await _context.Job.FindAsync(id); if (Job != null) { _context.Job.Remove(Job); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public string webJobsGet(string usr, int records, out string Data, out string x_outputMsg) { string OUTPUTRESPONSE = ""; Data = ""; x_outputMsg = ""; DataSet ds1 = new DataSet(); DataTable dt = new DataTable(); List <Models.Job> JobCollection = new List <Models.Job>(); try { conn = new SqlConnection(connString); cmd = conn.CreateCommand(); cmd.CommandText = "web_get_jobs"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@p_user_id", usr)); cmd.Parameters.Add(outputMsgParam); SqlDataAdapter SqlDa = new SqlDataAdapter(); SqlDa.SelectCommand = cmd; // SqlDa.SelectCommand.CommandType = CommandType.StoredProcedure; SqlDa.Fill(dt); try { OUTPUTRESPONSE = cmd.Parameters["@x_output_msg"].Value.ToString(); } catch (Exception ex) { } if (OUTPUTRESPONSE.Contains("ok")) { try { HttpContext.Current.Session["Start"] = "Starting"; HttpContext.Current.Session["ROWSEVENT"] = dt; foreach (DataRow row in dt.Rows) { Models.Job theJob = new Models.Job(); theJob.Employer = row[0].ToString(); theJob.Title = row[1].ToString(); theJob.Description = row[2].ToString(); theJob.ID = row[3].ToString(); theJob.PosterID = row[4].ToString(); theJob.Data = row[5].ToString(); if (row[6].ToString() == "False") { theJob.CanApply = "disabled"; } else { theJob.CanApply = ""; } JobCollection.Add(theJob); } Data = JsonConvert.SerializeObject(JobCollection); HttpContext.Current.Session["JSONSTRING11"] = Data; } catch (Exception ex) { x_outputMsg += "Problem parsing Data; " + ex.Message.ToString(); } } else { Data = ""; x_outputMsg = ""; } try { x_outputMsg += Convert.ToString(outputMsgParam.Value); } catch (Exception ex) { } return(OUTPUTRESPONSE); } catch (Exception ex) { x_outputMsg = ex.Message; isSuccessful = false; return(x_outputMsg); } finally { conn.Close(); } }