public void AddValue(decimal idSchool, decimal idVehicleType, decimal amount)
 {
     var sameVehicleTools =
         (from sv in EntitiesHolder.Entities.SchoolVehicles
          where sv.idSchool == idSchool && sv.idVehicleType == idVehicleType
          select sv).ToList();
     if (sameVehicleTools.Count > 0)
     {
         throw new ValueAlreadyExistsException();
     }
     SchoolVehicles schoolVehicles = new SchoolVehicles();
     schoolVehicles.idSchool = idSchool;
     schoolVehicles.idVehicleType = idVehicleType;
     schoolVehicles.amount = amount;
     EntitiesHolder.Entities.SchoolVehicles.AddObject(schoolVehicles);
     EntitiesHolder.Entities.SaveChanges();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SchoolVehicles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSchoolVehicles(SchoolVehicles schoolVehicles)
 {
     base.AddObject("SchoolVehicles", schoolVehicles);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new SchoolVehicles object.
 /// </summary>
 /// <param name="idSchool">Initial value of the idSchool property.</param>
 /// <param name="idVehicleType">Initial value of the idVehicleType property.</param>
 public static SchoolVehicles CreateSchoolVehicles(global::System.Decimal idSchool, global::System.Decimal idVehicleType)
 {
     SchoolVehicles schoolVehicles = new SchoolVehicles();
     schoolVehicles.idSchool = idSchool;
     schoolVehicles.idVehicleType = idVehicleType;
     return schoolVehicles;
 }