public void Add(Tehsil tehsil) { using (DefaultCS db = new DefaultCS()) { db.Tehsils.MergeOption = MergeOption.NoTracking; db.Tehsils.AddObject(tehsil); db.SaveChanges(); } }
public void Update(Tehsil tehsil) { using (DefaultCS db = new DefaultCS()) { var d = db.Tehsils.Where(i => i.Id == tehsil.Id).First(); d.TehsilName = tehsil.TehsilName; d.DistrictId = tehsil.DistrictId; db.SaveChanges(); } }
/// <summary> /// Create a new Tehsil object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="districtId">Initial value of the DistrictId property.</param> /// <param name="tehsilName">Initial value of the TehsilName property.</param> public static Tehsil CreateTehsil(global::System.Int32 id, global::System.Int32 districtId, global::System.String tehsilName) { Tehsil tehsil = new Tehsil(); tehsil.Id = id; tehsil.DistrictId = districtId; tehsil.TehsilName = tehsilName; return tehsil; }
/// <summary> /// Deprecated Method for adding a new object to the Tehsils EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTehsils(Tehsil tehsil) { base.AddObject("Tehsils", tehsil); }