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));
        }
 public string AllocateRoom(AllocateClassroom allocateClassroom)
 {
     if (IsRoomAlreadyAllocated(allocateClassroom))
     {
         return("Room is already allocated.");
     }
     else
     {
         if (aRoomGateway.AllocateRoom(allocateClassroom) > 0)
         {
             return("Classroom Successfully allocated.");
         }
         return("Classroom allocation failed!");
     }
 }