public sp_Group_DM ListGroups(int? groupID) { List<sp_Group_DM> list = new List<sp_Group_DM>(); try { using (VolTeerEntities context = new VolTeerEntities()) { list = (from result in context.sp_Group_Select(groupID) select new sp_Group_DM { GroupID = result.GroupID, GroupName = result.GroupName, ParticipationLevelID = result.ParticipationLevelID, ActiveFlg = result.ActiveFlg, ShortDesc = result.ShortDesc, LongDesc = result.LongDesc }).ToList(); } // Guaranteed to close the Connection } catch (Exception ex) { throw (ex); } return list.FirstOrDefault(); //return list.FirstOrDefault(); }
public List<sp_Group_DM> ListGroups(int iGroupID) { List<sp_Group_DM> list = new List<sp_Group_DM>(); using (VolTeerEntities context = new VolTeerEntities()) { list = (from result in context.sp_Group_Select(iGroupID) select new sp_Group_DM { GroupID = result.GroupID, GroupName = result.GroupName, ParticipationLevelID = result.ParticipationLevelID }).ToList(); } // Guaranteed to close the Connection return list; }