public int UpdateFuzzySet(FuzzySetBLL set) { try { int result = 0; if (IsExistFSName(set.FuzzySetName))//Update value { var _set = db.MotherLibraries.SingleOrDefault(name => name.LanguisticLabel == set.FuzzySetName); //Only update value _set.FuzzySet = ConvertToString(set.FuzzySet); return result = db.SaveChanges(true); } else//Mean add new object to DB { MotherLibrary mother = new MotherLibrary(); mother.ID = GetId(); mother.LanguisticLabel = set.FuzzySetName; mother.FuzzySet = ConvertToString(set.FuzzySet); db.AddToMotherLibraries(mother); return result = db.SaveChanges(true); } } catch (SQLiteException ex) { //throw new Exception(ex.Message); return -1; } }
/// <summary> /// Create a new MotherLibrary object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="languisticLabel">Initial value of the LanguisticLabel property.</param> public static MotherLibrary CreateMotherLibrary(global::System.Int32 id, global::System.String languisticLabel) { MotherLibrary motherLibrary = new MotherLibrary(); motherLibrary.ID = id; motherLibrary.LanguisticLabel = languisticLabel; return motherLibrary; }
/// <summary> /// Deprecated Method for adding a new object to the MotherLibraries EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMotherLibraries(MotherLibrary motherLibrary) { base.AddObject("MotherLibraries", motherLibrary); }