Пример #1
0
        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)));
        }
Пример #2
0
        public async Task <IActionResult> DeleteBoardMember(int id)
        {
            BoardMember member = await BoardMemberDb.GetBoardMemberById(_context, id);

            if (member == null)
            {
                return(NotFound());
            }
            return(View(member));
        }
Пример #3
0
        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());
        }
Пример #4
0
        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));
        }
Пример #5
0
        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());
        }