// add necessary data reservationviewmodel
        private void UpdateRvm(ReservationViewModel rvm)
        {
            if (rvm.Start == null)
            {
                rvm.Start = DateTime.Today;
                rvm.End   = DateTime.Today;
            }
            if (rvm.User.Department == null)
            {
                rvm.User.Department = departmentBll.ShowAllDepartments().FirstOrDefault(d => d.DepartmentId == rvm.User.DepartmentId);
            }
            rvm.Building = buildingBll.GetBuildingById(floorBll.GetFloorById(departmentBll.GetDepartmentById(rvm.User.DepartmentId).FloorId).BuildingId);

            rvm.Floors = floorBll.ShowAllFloors().Where(floor => floor.BuildingId == rvm.Building.BuildingId).ToList();
            foreach (var floor in rvm.Floors)
            {
                floor.Department = departmentBll.ShowAllDepartments().Where(d => d.FloorId == floor.FloorId).ToList();
                foreach (var d in floor.Department)
                {
                    d.FlexDesk = flexDeskBll.ShowAllFlexdesks().Where(fd => fd.DepartmentId == d.DepartmentId).ToList();
                }
                rvm.AddDeskIds(floor);
            }
            rvm.Reservations = new ReservationFE().GetReservations(flexDeskBll, reservationBll.ShowAllReservations().Where(r => ((r.StartDate >= rvm.Start && r.StartDate <= rvm.End) || (r.EndDate >= rvm.Start && r.EndDate <= rvm.End)) || ((rvm.Start >= r.StartDate && rvm.Start <= r.EndDate) || (rvm.End >= r.StartDate && rvm.End <= r.EndDate))));

            rvm.DefaultDesks = DefaultDesks((DateTime)rvm.Start, (DateTime)rvm.End);
        }
        // GET: Department
        public ActionResult Index(long floorId, long buildingId)
        {
            ViewData["sessionData"] = new int?[] { HttpContext.Session.GetInt32("admin"), HttpContext.Session.GetInt32("language") };

            if (floorId == 0)
            {
                return(View(new DepartmentViewModel {
                    Departments = departmentBll.ShowAllDepartments()
                }));
            }
            else
            {
                return(View(new DepartmentViewModel {
                    Departments = departmentBll.ShowAllDepartments().Where(d => d.FloorId == floorId), FloorId = floorId, BuildingId = buildingId
                }));
            }
        }
 public IEnumerable <Department> Get()
 {
     return(departmentBll.ShowAllDepartments());
 }
 public IEnumerable <Department> Get()
 {
     //return departmentProvider.Get();
     return(departmentBll.ShowAllDepartments());
 }