Skip to content

Commit

Permalink
Updated AboutController so that ConfirmDeleteStaff, ConfirmDeleteBoar…
Browse files Browse the repository at this point in the history
…d, and ConfirmDeleteSteeringCommittee methods no longer contain non-nullable type errors. (#312)

Co-authored-by: Joseph Ortiz <[email protected]>
  • Loading branch information
mcrowe1992 and JoeProgrammer88 authored Jun 10, 2024
1 parent 9113a12 commit e89286d
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions PC2/Controllers/AboutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ public async Task<IActionResult> DeleteStaff(int id)
[ActionName("DeleteStaff")]
public async Task<IActionResult> ConfirmDeleteStaff(int id)
{
Staff staff = await StaffDB.GetStaffMember(_context, id);
Staff? staff = await StaffDB.GetStaffMember(_context, id);

if (staff == null)
{
// If staff member is not found
return NotFound(); // Return a NotFound result
}

await StaffDB.Delete(_context, staff);
return RedirectToAction("IndexStaff");
}
Expand Down Expand Up @@ -135,7 +142,14 @@ public async Task<IActionResult> DeleteBoard(int id)
[ActionName("DeleteBoard")]
public async Task<IActionResult> ConfirmDeleteBoard(int id)
{
Board board = await BoardDB.GetBoardMember(_context, id);
Board? board = await BoardDB.GetBoardMember(_context, id);

if (board == null)
{
// If board member is not found
return NotFound(); // Return a NotFound result
}

await BoardDB.Delete(_context, board);
return RedirectToAction("IndexBoard");
}
Expand Down Expand Up @@ -195,7 +209,14 @@ public async Task<IActionResult> DeleteSteeringCommittee(int id)
[ActionName("DeleteSteeringCommittee")]
public async Task<IActionResult> ConfirmDeleteSteeringCommittee(int id)
{
SteeringCommittee steeringCommittee = await SteeringCommitteeDB.GetSteeringCommitteeMember(_context, id);
SteeringCommittee? steeringCommittee = await SteeringCommitteeDB.GetSteeringCommitteeMember(_context, id);

if (steeringCommittee == null)
{
// If the steering committee member is not found
return NotFound(); // Return a NotFound result
}

await SteeringCommitteeDB.Delete(_context, steeringCommittee);
return RedirectToAction("IndexSteeringCommittee");
}
Expand Down

0 comments on commit e89286d

Please sign in to comment.