LINQ のリストからデータを取得して一連のテキスト ボックスに表示できる予約システムを作成しようとしていますが、プログラムを実行すると数字の 1 が表示されるだけで問題が発生します。
これは私のコードです
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace BookingCustomers
{
public partial class BookingGuests : System.Web.UI.Page
{
private HotelConferenceEntities datacontext = new HotelConferenceEntities();
private void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
int id = int.Parse(BookID.Text.ToString());
tblBooking booking = datacontext.tblBookings.SingleOrDefault(x => x.BookingID == id);
tblVenue venue = datacontext.tblVenues.SingleOrDefault(x => x.VenueID == booking.Venue);
List<tblCustomer> customers = new List<tblCustomer>();
List<tblBookingGuest> guests = booking.tblBookingGuests.ToList();
foreach (tblBookingGuest guest in guests)
{
tblCustomer newcust = datacontext.tblCustomers.SingleOrDefault(x=>x.CustomerID == guest.CustomerID);
customers.Add(newcust);
}
int count = customers.Count;
//string table=string.Join(",",customers);
int [] displayer={customers.Count};
int max=(displayer.Max());
CustFirstName.Text =displayer.Where(p=> p== max).Count().ToString();