/// <summary> /// Добавить или править /// </summary> /// <param name="WAYS"></param> /// <returns></returns> public int SaveOWNERSCOUNTRIES(OWNERS_COUNTRIES OWNERSCOUNTRIES) { OWNERS_COUNTRIES dbEntry; if (OWNERSCOUNTRIES.id_own_country == 0) { dbEntry = new OWNERS_COUNTRIES() { id_own_country = OWNERSCOUNTRIES.id_own_country, name = OWNERSCOUNTRIES.name, id_ora = OWNERSCOUNTRIES.id_ora, }; context_edit.OWNERS_COUNTRIES.Add(dbEntry); } else { dbEntry = context_edit.OWNERS_COUNTRIES.Find(OWNERSCOUNTRIES.id_own_country); if (dbEntry != null) { dbEntry.name = OWNERSCOUNTRIES.name; dbEntry.id_ora = OWNERSCOUNTRIES.id_ora; } } try { context_edit.SaveChanges(); } catch (Exception e) { return(-1); } return(dbEntry.id_own_country); }
/// <summary> /// Получить id станы в системе RailCars по ID системы КИС /// </summary> /// <param name="id_ora"></param> /// <returns></returns> public int?GetIDOwnersContriesOfKis(int id_ora) { OWNERS_COUNTRIES oc = GetOwnersContriesOfKis(id_ora); if (oc != null) { return(oc.id_own_country); } return(null); }
/// <summary> /// Удалить /// </summary> /// <param name="id_way"></param> /// <returns></returns> public OWNERS_COUNTRIES DeleteOWNERSCOUNTRIES(int id_own_country) { OWNERS_COUNTRIES dbEntry = context_edit.OWNERS_COUNTRIES.Find(id_own_country); if (dbEntry != null) { context_edit.OWNERS_COUNTRIES.Remove(dbEntry); context_edit.SaveChanges(); } return(dbEntry); }
/// <summary> /// Добавить или править страну /// </summary> /// <param name="owner_contries"></param> /// <returns></returns> public int SaveOwnersContries(OWNERS_COUNTRIES owner_contries) { return(rep_oc.SaveOWNERSCOUNTRIES(owner_contries)); }
public void WL(OWNERS_COUNTRIES t) { Console.WriteLine("id_own_country: {0}, name: {1}, id_ora: {2}", t.id_own_country, t.name, t.id_ora); }