Editor.Services.PageServices.GetPagesByContentId C# (CSharp) Method

GetPagesByContentId() public method

public GetPagesByContentId ( int contentId ) : IList
contentId int
return IList
        public IList<PageDTO> GetPagesByContentId(int contentId)
        {
            using (ISession session = HibernateHelper.GetSession().OpenSession()) {
                using (ITransaction transaction = session.BeginTransaction()) {
                    try {
                        IList<Page> pages = new List<Page>();
                        pages = EditorServices.GetPageByContent(session, contentId) as List<Page>;

                        Mapper.CreateMap<Page, PageDTO>();
                        Mapper.CreateMap<PageElement, PageElementDTO>();
                        Mapper.CreateMap<Element, ElementDTO>();

                        return Mapper.Map<IList<Page>, IList<PageDTO>>(pages);

                    } catch (Exception ex) {
                        throw ex;
                    } finally {
                        session.Flush();
                        session.Close();
                    }
                }
            }
        }