Beispiel #1
0
        public void BanRoomViewModelTest()
        {
            var banRoomViewModel1 = new BanRoomViewModel();

            Assert.AreEqual(0, banRoomViewModel1.Rooms.Count);

            var rooms = new List<Room> {
                    new Room { Allowed = true, Id = 1, Name = "room1" }, 
                    new Room { Allowed = false, Id = 2, Name = "room2" }
                };

            var banRoomViewModel2 = new BanRoomViewModel { Rooms = rooms };

            Assert.AreEqual(2, banRoomViewModel2.Rooms.Count);

            Assert.True(banRoomViewModel2.Rooms.Count(r => r.Name == "room2") == 1);
        }
Beispiel #2
0
 public ActionResult DeleteRoom(String room)
 {
     var viewModel = new BanRoomViewModel();
     _BanStorage.DeleteRoom(_BanStorage.GetRoom(room));
     viewModel.Rooms = _BanStorage.GetRooms().ToList();
     return View("BanRoom", viewModel);
 }
Beispiel #3
0
        public ActionResult EditRooms()
        {
            var viewModel = new BanRoomViewModel { Rooms = this.BanStorage.GetRooms().ToList() };

            return this.View(viewModel);
        }
Beispiel #4
0
        public ActionResult BanRoom()
        {
            var viewModel = new BanRoomViewModel();
            viewModel.Rooms = _BanStorage.GetRooms().ToList();

            return View("BanRoom", viewModel);
        }