public void AddCountry(String fieldID, String name) { TblCountry newItem = new TblCountry { FieldID = fieldID, Name = name }; Insert(newItem); }
public void SyncCountries(List <Investment.Portable.TblCountry> result) { for (int i = 0; i < result.Count; i++) { try{ String id = result[i].ID.ToUpper(); TblCountry item = (from s in Table <TblCountry>() where s.FieldID.ToUpper().Equals(id) select s).FirstOrDefault(); if (item == null) { AddCountry(result[i].ID, result[i].Name); } else { item.FieldID = result[i].ID; item.Name = result[i].Name; Update(item); } } catch (Exception e) { } } }