This commit is contained in:
mmrbnjd
2024-04-02 17:14:18 +03:30
parent faa78adae6
commit dd4969f504
11 changed files with 315 additions and 402 deletions

View File

@@ -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); ;
}
}
}