Esempio n. 1
0
        /// <summary>
        /// Return a list of Sample projects using LINQ to SQL
        /// </summary>
        /// <returns></returns>
        public List<sp_Project_DM> ListProjects()
        {
            List<sp_Project_DM> list = new List<sp_Project_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_Project_Select(null)
                            select new sp_Project_DM
                            {
                                ProjectID = result.ProjectID,
                                ProjectName = result.ProjectName,
                                ProjectDesc = result.ProjectDesc,
                                AddrID = result.AddrID,
                                ActiveFlg = result.ActiveFlg
                            }).ToList();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return list;
        }