public void AddValue(decimal idSchool, decimal idToolType, decimal amount) { var sameSchoolTools = (from st in EntitiesHolder.Entities.SchoolTools where st.idSchool == idSchool && st.idToolType == idToolType select st).ToList(); if (sameSchoolTools.Count > 0) { throw new ValueAlreadyExistsException(); } SchoolTools schoolTools = new SchoolTools(); schoolTools.idSchool = idSchool; schoolTools.idToolType = idToolType; schoolTools.amount = amount; EntitiesHolder.Entities.SchoolTools.AddObject(schoolTools); EntitiesHolder.Entities.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the SchoolTools EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSchoolTools(SchoolTools schoolTools) { base.AddObject("SchoolTools", schoolTools); }
/// <summary> /// Create a new SchoolTools object. /// </summary> /// <param name="idSchool">Initial value of the idSchool property.</param> /// <param name="idToolType">Initial value of the idToolType property.</param> public static SchoolTools CreateSchoolTools(global::System.Decimal idSchool, global::System.Decimal idToolType) { SchoolTools schoolTools = new SchoolTools(); schoolTools.idSchool = idSchool; schoolTools.idToolType = idToolType; return schoolTools; }