//Updates the advertisement public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Advertisement).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AdvertisementExists(Advertisement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
//Adds a candidate to database. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Candidate.Add(Candidate); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Adds an advertisement to database. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Advertisement.Add(Advertisement); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Removes the application . selects the appplication using a linq query. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Application = (from application in _context.Application where application.Id == id select application).FirstOrDefault(); if (Application != null) { _context.Application.Remove(Application); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Deletes a employer from databse uses a liq query to get the employer. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Employer = (from employer in _context.Employer where employer.Id == id select employer).FirstOrDefault(); if (Employer != null) { _context.Employer.Remove(Employer); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes the advertisement uses a linq query to get the advertisement. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Advertisement = (from advertisement in _context.Advertisement where advertisement.Id == id select advertisement).FirstOrDefault(); if (Advertisement != null) { _context.Advertisement.Remove(Advertisement); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes the candidate used a linq query to get the record. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Candidate = (from candidate in _context.Candidate where candidate.Id == id select candidate).FirstOrDefault(); if (Candidate != null) { _context.Candidate.Remove(Candidate); _context.SaveChanges(); } return(RedirectToPage("./Index")); }