/// <summary> /// Gets the details for the specific areas of improvement /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> OnGetAsync(int?id) { //checks to see if id passed is null if (id == null) { return(NotFound()); } //Queries the database for AreasOfImprovement based on the id passed in AreasOfImprovement = await _context.AreasOfImprovement.FirstOrDefaultAsync(m => m.ID == id); //checks to see if specified areas of improvement is null if (AreasOfImprovement == null) { return(NotFound()); } return(Page()); }
/// <summary> /// Deletes the Specified areas of improvement /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> OnPostAsync(int?id) { //checks to see if id is null if (id == null) { return(NotFound()); } //Queries the database for areas of improvement based on the id passed in AreasOfImprovement = await _context.AreasOfImprovement.FindAsync(id); //checks to see if areas of improvement is not null and if not then delete areas of improvment if (AreasOfImprovement != null) { _context.AreasOfImprovement.Remove(AreasOfImprovement); await _context.SaveChangesAsync(); } return(RedirectToPage("./Detail")); }