public List<sp_GroupAddr_DM> ListAddresses(sp_GroupAddr_DM cGroupAddr) { List<sp_GroupAddr_DM> list = new List<sp_GroupAddr_DM>(); try { using (VolTeerEntities context = new VolTeerEntities()) { list = (from result in context.sp_GroupAddr_Select(cGroupAddr.GroupID, cGroupAddr.AddrID) select new sp_GroupAddr_DM { GroupID = result.GroupID, AddrID = result.AddrID, PrimaryAddrID = result.PrimaryAddrID, ActiveFlg = result.ActiveFlg }).ToList(); } // Guaranteed to close the Connection } catch (Exception ex) { throw (ex); } return list; }
public sp_GroupAddr_DM ListPrimaryAddress(sp_GroupAddr_DM cGroupAddr) { sp_GroupAddr_DM item = new sp_GroupAddr_DM(); try { using (VolTeerEntities context = new VolTeerEntities()) { item = (from result in context.sp_GroupAddr_Select(cGroupAddr.GroupID, cGroupAddr.AddrID) select new sp_GroupAddr_DM { GroupID = result.GroupID, AddrID = result.AddrID, PrimaryAddrID = result.PrimaryAddrID, ActiveFlg = result.ActiveFlg }).FirstOrDefault(); } // Guaranteed to close the Connection } catch (Exception ex) { throw (ex); } return item; }