/// <summary> /// Deletes a LinkSubstationPool record in Db (based on substation ID and pool ID) /// </summary> /// <param name="substationId">substation id</param> /// <param name="poolId">pool id</param> public void DeleteSubstationPool(int substationId, int poolId) { LinkSubstationPool currentlinksubstpool = (from lsp in this.Context.LinkSubstationPools.Where(l => l.SubstationId.Equals(substationId) && l.PoolId.Equals(poolId)) select lsp).FirstOrDefault(); if (currentlinksubstpool != null) { this.Context.LinkSubstationPools.Remove(currentlinksubstpool); this.Context.SaveChanges(); } }
/// <summary> /// Inserts a new LinkSubstationPool object to Db (based on substation ID and pool ID) /// </summary> /// <param name="cutplane">Cutplane object</param> public void SaveSubstationPool(int substationId, int poolId) { LinkSubstationPool currentlinksubstpool = (from lsp in this.Context.LinkSubstationPools.Where(l => l.SubstationId.Equals(substationId) && l.PoolId.Equals(poolId)) select lsp).FirstOrDefault(); if (currentlinksubstpool == null) { LinkSubstationPool linksubstationpool = new LinkSubstationPool(); linksubstationpool.SubstationId = substationId; linksubstationpool.PoolId = poolId; linksubstationpool.DateCreated = DateTime.Now; this.Context.LinkSubstationPools.Add(linksubstationpool); this.Context.SaveChanges(); } }