public void SaveSeeingPlace(Rootobject seeing) { var type = new TouristicType { Name = "Manzara seyir noktaları", CategoryId = 22 }; UnitOfWork.CurrentSession.TouristicTypes.Add(type); foreach (var item in seeing.response.venues) { var data = new Touristic { Name = item.name, Long = item.location != null ? item.location.lng : "", Lat = item.location != null ? item.location.lat : "", Phone = item.contact != null ? item.contact.phone : "", Url = item.url ?? "", TouristicTypeId = type.Id, IconId = 18 }; UnitOfWork.CurrentSession.Touristics.Add(data); } UnitOfWork.CurrentSession.SaveChanges(); }
public void SaveTouristic(Rootobject info) { var cat = new Category { Name = "Turistik", Color = "#ffda00" }; UnitOfWork.CurrentSession.Categories.Add(cat); var type = new TouristicType { Name = "Bilgilendirme", CategoryId = cat.Id }; UnitOfWork.CurrentSession.TouristicTypes.Add(type); foreach (var item in info.response.venues) { var data = new Touristic { Name = item.name, Long = item.location != null ? item.location.lng : "", Lat = item.location != null ? item.location.lat : "", Phone = item.contact != null ? item.contact.phone : "", Url = item.url ?? "", TouristicTypeId = type.Id, IconId = 17 }; UnitOfWork.CurrentSession.Touristics.Add(data); } UnitOfWork.CurrentSession.SaveChanges(); }
public void SaveFestivalPlaces(Rootobject venue) { var cat = new Category(); var category = UnitOfWork.CurrentSession.Categories.FirstOrDefault(x => x.Name == "Turistik"); if (category != null) { cat = category; } else { cat = new Category { Name = "Turistik", Color = "#ffda00" }; UnitOfWork.CurrentSession.Categories.Add(cat); } var type = new TouristicType { Name = "Festival Alanları", CategoryId = cat.Id }; UnitOfWork.CurrentSession.TouristicTypes.Add(type); foreach (var item in venue.response.venues) { var data = new Touristic { Name = item.name, Long = item.location != null ? item.location.lng : "", Lat = item.location != null ? item.location.lat : "", Phone = item.contact != null ? item.contact.phone : "", Url = item.url ?? "", TouristicTypeId = type.Id, IconId = 9 }; UnitOfWork.CurrentSession.Touristics.Add(data); } UnitOfWork.CurrentSession.SaveChanges(); }