In my View, I want to display Guest Id's seperated by a comma but I don't know how. Right now it looks like the image below. 16 and 17 are Id's from seperate guests. This is confusing.

enter image description here

My model looks like this:

public class Guest
    public int GuestId { get; set; }
    //Vreemde sleutel van Reservation
    public Int32? ReservationId { get; set; }

The controller generating the View looks like this:

public ActionResult Index()
        return View(_reservationrepository.GetAllReservations());

public IQueryable GetAllReservations()
        return db.Reservations.Include(r => => r.User).Include(r => r.Guests);


My View displaying the Id's looks like this:

@foreach (var item in Model) {
        @Html.DisplayFor(modelItem => item.Guests)

How can I make the guest Id's seperated by a comma?

Related posts

Recent Viewed