public IEnumerable GetRooms()
        {
            //we need to convert the rom ID from a string to an INT. So that when it gets ordered it is done with an int not a string
            //List<Rooms> allRooms = new List<Rooms>();
            //List<RoomsWithIntDTO> allRoomswithInt = new List<RoomsWithIntDTO>();
            ////display ordered by ID
            //allRooms.AddRange(_context.Rooms.OrderBy(r => r.ID).ThenBy(r => r.Title));

            //foreach (var room in allRooms)
            //{
            //    RoomsWithIntDTO newrooms = new RoomsWithIntDTO();
            //    newrooms.ID = Convert.ToInt32(room.ID);
            //    newrooms.Title = room.Title;
            //    newrooms.EventColor = room.EventColor;
            //    allRoomswithInt.Add(newrooms);
            //}

            var or = new OrderedRooms(_context);

            return(or.GetOrderedRooms()); //allRoomswithInt.OrderBy(r => r.ID);
        }
Ejemplo n.º 2
0
 // GET: Events/Create
 public IActionResult Create()
 {
     ViewBag.TodayDate = DateTime.Today.ToLongDateString();
     ViewBag.Roomlist  = new SelectList(or.GetOrderedRooms(), "ID", "Title", "MaxOccupancy");
     return(View());
 }