public IActionResult OnGet() { var members = _context.Set <Member>().Select(m => new { MemberId = m.MemberId, NameAndPhoneNo = $"{m.Name} ({m.PhoneNo})" }) .ToList(); ViewData["MemberId"] = new SelectList(members, "MemberId", "NameAndPhoneNo"); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } QueueEntry = await _context.QueueEntries .Include(q => q.Member).FirstOrDefaultAsync(m => m.Id == id); if (QueueEntry == null) { return(NotFound()); } var members = _context.Set <Member>().Select(m => new { MemberId = m.MemberId, NameAndPhoneNo = $"{m.Name} ({m.PhoneNo})" }) .ToList(); ViewData["MemberId"] = new SelectList(members, "MemberId", "NameAndPhoneNo"); return(Page()); }