Пример #1
0
        public virtual ActionResult Index()
        {
            var locations = _genericRepository.GetAll<Location>().ToList();
            var indexModels = new List<IndexModel>();

            foreach (var location in locations)
            {
                var indexModel = new IndexModel();
                 _locationToIndexModelMapper.Map(location, indexModel);
                indexModels.Add(indexModel);
            }

            return View(indexModels);
        }
Пример #2
0
        public void ShouldMapLocationToIndexModel()
        {
            var locationIndexModel = new IndexModel();
            var locationEntity = new Web.Data.Entities.Location
            {
                ClassroomIdentificationCode = "BKL200",
                MaximumNumberOfSeats = 50,
                OptimalNumberOfSeats = 30
            };

            var locationToIndexMapper = new LocationToIndexModelMapper();
            locationToIndexMapper.Map(locationEntity, locationIndexModel);

            locationIndexModel.ClassroomIdentificationCode.ShouldBe("BKL200");
            locationIndexModel.MaximumNumberOfSeats.ShouldBe(50);
            locationIndexModel.OptimalNumberOfSeats.ShouldBe(30);
        }
Пример #3
0
        public void ShouldMapLocationToIndexModel()
        {
            var locationIndexModel = new IndexModel();
            var locationEntity     = new Web.Data.Entities.Location
            {
                ClassroomIdentificationCode = "BKL200",
                MaximumNumberOfSeats        = 50,
                OptimalNumberOfSeats        = 30
            };

            var locationToIndexMapper = new LocationToIndexModelMapper();

            locationToIndexMapper.Map(locationEntity, locationIndexModel);

            locationIndexModel.ClassroomIdentificationCode.ShouldBe("BKL200");
            locationIndexModel.MaximumNumberOfSeats.ShouldBe(50);
            locationIndexModel.OptimalNumberOfSeats.ShouldBe(30);
        }