Example #1
0
        public static IPagedList <T> FetchList <T, TE>(IPagedList <TE> list)
            where T : ModelBase, new()
            where TE : class, new()
        {
            var result = list.Select(item => ObjectUtil.Fetch(new T(), item)).ToList();

            return(new PagedList <T>(result, list.PageNumber, list.PageSize, list.TotalItemCount));
        }
Example #2
0
        /// <summary>
        /// Fetch list data using default object factory
        /// </summary>
        /// <typeparam name="T">Model object type</typeparam>
        /// <typeparam name="TE">Any type that has empty constructor</typeparam>
        /// <param name="list">Entity list to fetch data</param>
        /// <returns>Return a model list</returns>
        public static IList <T> FetchList <T, TE>(IEnumerable <TE> list)
            where T : ModelBase, new()
            where TE : class, new()
        {
            var result = new List <T>();

            foreach (var item in list)
            {
                result.Add(ObjectUtil.Fetch(new T(), item));
            }
            return(result);
        }
Example #3
0
 /// <summary>
 /// Fetch list data using default object factory
 /// </summary>
 /// <typeparam name="T">Model object type</typeparam>
 /// <typeparam name="TE">Any type that has empty constructor</typeparam>
 /// <param name="list">Entity list to fetch data</param>
 /// <returns>Return a model list</returns>
 public static IList <T> FetchList <T, TE>(IEnumerable <TE> list)
     where T : ModelBase, new()
     where TE : class, new()
 {
     return(list.Select(item => ObjectUtil.Fetch(new T(), item)).ToList());
 }