Пример #1
0
 public void Update(District district)
 {
     using (DefaultCS db = new DefaultCS())
     {
         var d = db.Districts.Where(i => i.Id == district.Id).First();
         d.DistrictName = district.DistrictName;
         db.SaveChanges();
     }
 }
Пример #2
0
 public void Add(District district)
 {
     using (DefaultCS db = new DefaultCS())
     {
         db.Districts.MergeOption = MergeOption.NoTracking;
         db.Districts.AddObject(district);
         db.SaveChanges();
     }
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Districts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDistricts(District district)
 {
     base.AddObject("Districts", district);
 }
Пример #4
0
 /// <summary>
 /// Create a new District object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="districtName">Initial value of the DistrictName property.</param>
 public static District CreateDistrict(global::System.Int32 id, global::System.String districtName)
 {
     District district = new District();
     district.Id = id;
     district.DistrictName = districtName;
     return district;
 }