Exemplo n.º 1
0
        public ActionResult Home()
        {
            IList <Edge> edges;
            IList <City> cities2;

            using (var context = new TLContext())
            {
                edges   = context.GetAllEdges();
                cities2 = context.GetCities().ToList();
            }
            var cities    = MappingService.GetCities();
            var dtoCities = new List <CityDTO>();

            foreach (var city in cities)
            {
                dtoCities.Add(new CityDTO()
                {
                    Id   = city.ID,
                    Name = city.Name
                });
            }

            var parcelTypes    = MappingService.GetParcelTypes();
            var dtoParcelTypes = new List <ParcelTypeDTO>();

            foreach (var parcelType in parcelTypes)
            {
                dtoParcelTypes.Add(new ParcelTypeDTO()
                {
                    Id   = parcelType.ID,
                    Name = parcelType.Name
                });
            }

            var model = new HomeDTO
            {
                SourceCitites      = dtoCities,
                DestinationCitites = dtoCities,
                ParcelTypes        = dtoParcelTypes
            };

            return(View(model));
        }