public async Task <IActionResult> DeleteConfirmed(int id) { BoardMember member = await BoardMemberDb.GetBoardMemberById(_context, id); await BoardMemberDb.DeleteBoardMember(_context, member); TempData["Message"] = $"{member.Name} deleted successfully"; return(RedirectToAction(nameof(FairBoard))); }
public async Task <IActionResult> DeleteBoardMember(int id) { BoardMember member = await BoardMemberDb.GetBoardMemberById(_context, id); if (member == null) { return(NotFound()); } return(View(member)); }
public async Task <IActionResult> EditBoardMember(BoardMember member) { if (ModelState.IsValid) { await BoardMemberDb.UpdateBoardMember(_context, member); TempData["Message"] = $"{member.Name} edited successfully"; return(RedirectToAction(nameof(FairBoard))); } return(View()); }
public async Task <IActionResult> EditBoardMember(int?id) { if (id == null) { return(BadRequest()); } BoardMember member = await BoardMemberDb.GetBoardMemberById(_context, id.Value); if (member == null) { return(NotFound()); } return(View(member)); }
public async Task <IActionResult> FairBoard() { List <BoardMember> clubOfficers = new List <BoardMember>(); List <BoardMember> fairOfficers = new List <BoardMember>(); List <BoardMember> members = await BoardMemberDb.GetAllBoardMembers(_context); foreach (BoardMember item in members) { if (item.FairOrClubOfficer.Equals("Club Officer")) { clubOfficers.Add(item); } else { fairOfficers.Add(item); } } ViewBag.ClubOfficers = clubOfficers; ViewBag.FairOfficers = fairOfficers; return(View()); }