...
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
@@ -25,17 +26,18 @@ namespace Back.Services
|
||||
PermissionID=x.PermissionID,
|
||||
}).ToListAsync();
|
||||
}
|
||||
public async Task<List<BlogDto>> GetBlog(int count)
|
||||
public async Task<PagingDto<BlogDto>> GetBlog(int PageIndex, int PageSize)
|
||||
{
|
||||
return await _repoBlog.Get(w=>w.Status).OrderByDescending(o=>o.ID).Take(count)
|
||||
return await _repoBlog.Get(w=>w.Status).OrderByDescending(o=>o.ID)
|
||||
.Select(s=>new BlogDto
|
||||
{
|
||||
Title = s.Title,
|
||||
Date=s.Date,
|
||||
ID=s.ID,
|
||||
Photo=string.IsNullOrEmpty(s.Photo) ? "blog-grid-1.jpg" : s.Photo
|
||||
})
|
||||
.ToListAsync();
|
||||
}).Paging(PageIndex, PageSize); ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user