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));
        }
Exemple #3
0
        public List <SelectListItem> GetAllDaysForDropDown()
        {
            List <Day> days = dayGateway.GetAllDays();

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

            List <SelectListItem> mainSelectListItems = new List <SelectListItem>();

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

            mainSelectListItems.AddRange(selectListItems);

            return(mainSelectListItems);
        }
        public List <SelectListItem> GetAllDayForDropdown()
        {
            List <Day>            days = dayGateway.GetAllDays();
            List <SelectListItem> selectListItemsList = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Text = "---Select---", Value = ""
                }
            };

            foreach (Day day in days)
            {
                SelectListItem selectListItem = new SelectListItem();
                selectListItem.Text  = day.Name;
                selectListItem.Value = day.Id.ToString();
                selectListItemsList.Add(selectListItem);
            }

            return(selectListItemsList);
        }
Exemple #5
0
 public List <Day> GetAllDays()
 {
     return(aDayGateway.GetAllDays());
 }
 public IEnumerable <Day> GetAllDays()
 {
     return(aDayGateway.GetAllDays());
 }
Exemple #7
0
        public List <Day> GetAllDays()
        {
            DayGateway dayGate = new DayGateway();

            return(dayGate.GetAllDays());
        }