public async Task SeedAsync(DbContext dbConext)
        {
            var locationSet = dbConext.Set <GeographicaLocation>();

            HoChiMinh = locationSet.SeedEntity(HoChiMinh);
            DaNang    = locationSet.SeedEntity(DaNang);

            await dbConext.SaveChangesAsync();
        }
Exemple #2
0
        public static GeographicaLocationViewModel FromEntity(GeographicaLocation entity)
        {
            var viewModel = new GeographicaLocationViewModel
            {
                Id    = entity.Id,
                Name  = entity.Name,
                Label = entity.Label,
            };

            if (entity.JsonOptions != null)
            {
                viewModel.Marker = Newtonsoft.Json.JsonConvert.DeserializeObject <MapMarkerViewModel>(entity.JsonOptions);
            }

            return(viewModel);
        }