public ViewResult Allocate(ClassroomAllocation classroomAllocation)
        {
            ClassroomAllocationViewModel viewModel = new ClassroomAllocationViewModel
            {
                Departments = DepartmentGateway.GetAllDepartments(),
                Days        = DayGateway.GetAllDays(),
                Rooms       = RoomGateway.GetAllRooms()
            };

            if (!ModelState.IsValid)
            {
                viewModel.ClassroomAllocation = classroomAllocation;
                ViewBag.Message = "Unsuccessful";
                return(View(viewModel));
            }


            int rowAffected = RoomGateway.AllocateRoom(classroomAllocation);

            if (rowAffected > 0)
            {
                ViewBag.Message = "Successful";
            }
            else
            {
                ViewBag.Message = "Not Saved";
            }

            return(View(viewModel));
        }
        // GET: Room/Allocate
        public ViewResult Allocate()
        {
            ClassroomAllocationViewModel viewModel = new ClassroomAllocationViewModel
            {
                Departments = DepartmentGateway.GetAllDepartments(),
                Days        = DayGateway.GetAllDays(),
                Rooms       = RoomGateway.GetAllRooms()
            };

            return(View(viewModel));
        }
        public List <SelectListItem> GetAllRoomsForDropDown()
        {
            List <Room> rooms = roomGateway.GetAllRooms();

            List <SelectListItem> selectListItems =
                rooms.ConvertAll(x => new SelectListItem()
            {
                Text = x.RoomNo, Value = x.Id.ToString()
            });
            List <SelectListItem> mainSelectListItems = new List <SelectListItem>();

            mainSelectListItems.Add(new SelectListItem()
            {
                Text = "--Select Room--", Value = ""
            });

            mainSelectListItems.AddRange(selectListItems);

            return(mainSelectListItems);
        }
Beispiel #4
0
        public List <SelectListItem> GetAllRoomForDropdown()
        {
            List <Room>           rooms = roomGateway.GetAllRooms();
            List <SelectListItem> selectListItemsList = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Text = "---Select---", Value = ""
                }
            };

            foreach (Room room in rooms)
            {
                SelectListItem selectListItem = new SelectListItem();
                selectListItem.Text  = room.Name;
                selectListItem.Value = room.Id.ToString();
                selectListItemsList.Add(selectListItem);
            }

            return(selectListItemsList);
        }
 public List <Room> GetAllRooms()
 {
     return(roomGateway.GetAllRooms());
 }
Beispiel #6
0
        public List <Room> GetAllRooms()
        {
            RoomGateway roomGate = new RoomGateway();

            return(roomGate.GetAllRooms());
        }
Beispiel #7
0
 public List <RoomInfo> GetAllRooms()
 {
     return(aRoomGateway.GetAllRooms());
 }
Beispiel #8
0
 public List <Room> GetAllRoomsManager()
 {
     return(aRoomGateway.GetAllRooms());
 }