Esempio n. 1
0
        // Helper method for GuestId Dropdown to display with Last and First name
        private List <SelectListItem> AccessGuestIdList()
        {
            var service = new GuestService(User.Identity.GetUserId());
            List <SelectListItem> guests = new List <SelectListItem>();

            foreach (var guest in service.GetGuestByFullName().OrderBy(g => g.LastName))
            {
                guests.Add(
                    new SelectListItem {
                    Text  = guest.LastName + ", " + guest.FirstName,    // Realize I have FullName but wanted to practice concatenation
                    Value = guest.GuestId.ToString()
                });
            }
            return(guests);
        }