public void Add(Block block) { using (DefaultCS db = new DefaultCS()) { db.Blocks.MergeOption = MergeOption.NoTracking; db.Blocks.AddObject(block); db.SaveChanges(); } }
public void Update(Block block) { using (DefaultCS db = new DefaultCS()) { var d = db.Blocks.Where(i => i.Id == block.Id).First(); d.BlockName = block.BlockName; d.SectionId = block.SectionId; d.OfficerName = block.OfficerName; d.STD = block.STD; d.PhoneNo = block.PhoneNo; d.FaxNo = block.FaxNo; d.MobileNo = block.MobileNo; d.UpdatedBy = block.UpdatedBy; d.UpdatedDate = block.UpdatedDate; db.SaveChanges(); } }
/// <summary> /// Create a new Block object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="rangeId">Initial value of the RangeId property.</param> /// <param name="blockName">Initial value of the BlockName property.</param> public static Block CreateBlock(global::System.Int32 id, global::System.Int32 rangeId, global::System.String blockName) { Block block = new Block(); block.Id = id; block.RangeId = rangeId; block.BlockName = blockName; return block; }
/// <summary> /// Deprecated Method for adding a new object to the Blocks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBlocks(Block block) { base.AddObject("Blocks", block); }
public int InsertBlock(Block block) { using (DefaultCS db = new DefaultCS()) { db.Blocks.MergeOption = MergeOption.NoTracking; db.Blocks.AddObject(block); db.SaveChanges(); return block.Id; } }