How to Display Value From Separate Table on Razor Page Create.cshtml

I have a Create page to create data for my Supervisor model. It looks like this:

The Supervisor class is here:

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Votes.Model
{
    public class Supervisor
    {
        [Key]
        public int SupervisorId { get; set; }

        [Display(Name = "Supervisor Last Name")]
        public string? SupLastName { get; set; }

        [Display(Name = "Supervisor First Name")]
        public string? SupFirstName { get; set; }

        [Display(Name = "Ward")]
        public int? Ward { get; set; }

        [Display(Name = "District")]
        public int? District { get; set; }

        public ICollection<Committee>? Committees { get; set; }

        [Display(Name = "Chair/Member Committee 1")]
        public string? MemberComm1 { get; set; }

        [Display(Name = " Chair/Member Committee 2")]
        public string? MemberComm2 { get; set; }
    }
}

public enum MemberComm1
{
    C,
    M,
    X
}

public enum MemberComm2
{
    C,
    M,
    X
}

Instead of the label for each MemberComm1 (Chair/Member Committee 1), MemberComm2 (Chair/Member Committee 2), etc, I would like to have the actual name of that committee (stored in the CommitteeDesc field).

Here is the Committee model:

using System.ComponentModel.DataAnnotations;

namespace Votes.Model
{
    public class Committee
    {
        [Key]
        public int CommitteeId { get; set; }

        [Required]
        [Display(Name = "Committee No")]
        public int CommitteeNo { get; set; }
       
        [Required]
        [Display(Name = "Committee Description")]
        public string? CommitteeDesc { get; set; }
        
        [Required]
        [Display(Name = "Committee Type")]
        public string? CommitteeType { get; set; }

        public ICollection<Supervisor> Supervisors { get; set; }
    }
}

Since the Committees each have a fixed CommitteeNo assigned to them (1, 2, etc), I would like to use some type of if statement to say if Committee.CommitteeNo == 1, then CommitteeDesc. I would just like to use this as a label (ie, 1 = Finance Committee, 2 = Govt Operations, etc. It would not be committed to any database table.

I have tried a variety of @Html.DisplayNameFor and IEnumerables, but I just can’t figure out the syntax.

Here is the .cs for the Create page as it is now.

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Votes.Data;
using Votes.Model;
using System.Linq;

namespace Votes.Pages.Supervisors;

[BindProperties]

public class CreateModel : PageModel
{
    private readonly ApplicationDbContext _db;
    public Supervisor Supervisor { get; set; }
    public Committee Committee { get; set; }

    public IList<Committee> CommitteeList { get; set; }

    public CreateModel(ApplicationDbContext db)
    {
        _db = db;
    }

    public IEnumerable<Committee> DisplayCommitteeData { get; set; } 
    public IEnumerable<Municipality> DisplayMunicipalityData { get; set; }
    public IEnumerable<Ward> DisplayWardData { get; set; }
    public IEnumerable<District> DisplayDistrictData { get; set; }

    public async Task OnGet()
    {
        await _db.Committee.Select(a => a.CommitteeId).ToListAsync();
        DisplayCommitteeData = await _db.Committee.ToListAsync();
        await _db.Municipality.Select(a => a.MunicipalityId).ToListAsync();
        DisplayMunicipalityData = await _db.Municipality.ToListAsync();
        await _db.Ward.Select(a => a.WardId).ToListAsync();
        DisplayWardData = await _db.Ward.ToListAsync();
        await _db.District.Select(a => a.DistrictId).ToListAsync();
        DisplayDistrictData = await _db.District.ToListAsync();
    }

    public async Task<IActionResult> OnPost()
    {
        if (ModelState.IsValid)
        {
            _db.Supervisor.Add(Supervisor);
            await _db.Supervisor.AddAsync(Supervisor);
            await _db.SaveChangesAsync();
            TempData["success"] = "Supervisor added successfully.";
            return RedirectToPage("Index");
        }
        return Page();
    }
}

As you can see, I’ve got extra stuff I don’t likely need. All in my attempts to get this to work. Can anyone please describe the direction I should be going? A frequent error I am getting is that the object cannot be null. There is full Committee data in the Committee table.

Thanks in advance for any and all assistance.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật