|
@@ -1,9 +1,9 @@
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
-using System.Threading.Tasks;
|
|
|
+using CasinosManager.Api.Domain;
|
|
|
+using CasinosManager.Api.Dto;
|
|
|
+using CasinosManager.Api.Service;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace CasinosManager.Api.Controllers
|
|
|
{
|
|
@@ -11,19 +11,18 @@ namespace CasinosManager.Api.Controllers
|
|
|
[ApiController]
|
|
|
public class ValuesController : ControllerBase
|
|
|
{
|
|
|
- // GET api/values
|
|
|
- [HttpGet]
|
|
|
- public ActionResult<IEnumerable<string>> Get()
|
|
|
+ [HttpGet()]
|
|
|
+ public ActionResult<PageListOutput<Student>> Get(int page, int pageSize)
|
|
|
{
|
|
|
- return new string[] { "value1", "value2" };
|
|
|
- }
|
|
|
+ PageListOutput<Student> output = new PageListOutput<Student>();
|
|
|
|
|
|
- // GET api/values/5
|
|
|
- [HttpGet("{id}")]
|
|
|
- [Authorize]
|
|
|
- public ActionResult<string> Get(int id)
|
|
|
- {
|
|
|
- return "value";
|
|
|
+ MockDataService service = new MockDataService();
|
|
|
+
|
|
|
+ int skip = (page - 1) * pageSize;
|
|
|
+ output.Total = service.GetStudents().Count();
|
|
|
+ output.Data = service.GetStudents().Skip(skip).Take(pageSize).ToList();
|
|
|
+
|
|
|
+ return output;
|
|
|
}
|
|
|
|
|
|
// POST api/values
|