Ejemplo n.º 1
0
 /// <summary>
 /// Get top 4 lasted news
 /// </summary>
 /// <returns>List<PostViewModel></returns>
 public static List <PostViewModel> GetTop4LastedNews()
 {
     try
     {
         using (var _context = new TDHEntities())
         {
             return(_context.PROC_WEB_VIEW_POST_Top4Lasted()
                    .Select(m => new PostViewModel()
             {
                 Alias = m.alias,
                 Title = m.title,
                 Image = m.image,
                 CreateDate = m.create_date
             }).ToList());
         }
     }
     catch (Exception ex)
     {
         throw new UserException(FILE_NAME, MethodInfo.GetCurrentMethod().Name, 500, ErrorMessage.ErrorService, ex);
     }
 }