public void SaveKargo(Rootobject kargo) { var type = new ContactType { Name = "Kargo", CategoryId = 9 }; UnitOfWork.CurrentSession.ContactTypes.Add(type); foreach (var item in kargo.response.venues) { var data = new Domain.Domains.Contact { 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 ?? "", ContactTypeId = type.Id }; UnitOfWork.CurrentSession.Contacts.Add(data); } UnitOfWork.CurrentSession.SaveChanges(); }
public void SavePtt(Rootobject ptt) { var cat = new Category { Name = "İletişim", //IconId = 2 }; UnitOfWork.CurrentSession.Categories.Add(cat); var type = new ContactType { Name = "Ptt", CategoryId = cat.Id }; UnitOfWork.CurrentSession.ContactTypes.Add(type); foreach (var item in ptt.response.venues) { var data = new Domain.Domains.Contact { Name = item.name, ContactTypeId = type.Id, Lat = item.location != null ? item.location.lat : "", Long = item.location != null ? item.location.lng : "", Phone = item.contact != null ? item.contact.phone : "", Url = item.url ?? "" }; UnitOfWork.CurrentSession.Contacts.Add(data); } UnitOfWork.CurrentSession.SaveChanges(); }