|
@@ -1,8 +1,8 @@
|
|
using CasinosManager.Api.Domain;
|
|
using CasinosManager.Api.Domain;
|
|
|
|
+using CasinosManager.Api.Dto;
|
|
using CasinosManager.Api.Service;
|
|
using CasinosManager.Api.Service;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
-using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
|
|
namespace CasinosManager.Api.Controllers
|
|
namespace CasinosManager.Api.Controllers
|
|
@@ -14,14 +14,17 @@ namespace CasinosManager.Api.Controllers
|
|
{
|
|
{
|
|
// GET api/values
|
|
// GET api/values
|
|
[HttpGet]
|
|
[HttpGet]
|
|
- public ActionResult<List<Student>> Get(int page, int pageSize)
|
|
|
|
|
|
+ public ActionResult<PageListOutput<Student>> Get(int page, int pageSize)
|
|
{
|
|
{
|
|
|
|
+ PageListOutput<Student> output = new PageListOutput<Student>();
|
|
|
|
+
|
|
MockDataService service = new MockDataService();
|
|
MockDataService service = new MockDataService();
|
|
|
|
|
|
int skip = (page - 1) * pageSize;
|
|
int skip = (page - 1) * pageSize;
|
|
- var data = service.GetStudents().Skip(skip).Take(pageSize).ToList();
|
|
|
|
|
|
+ output.Total = service.GetStudents().Count();
|
|
|
|
+ output.Data = service.GetStudents().Skip(skip).Take(pageSize).ToList();
|
|
|
|
|
|
- return data;
|
|
|
|
|
|
+ return output;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|