Search by layer number
This commit is contained in:
@@ -1,17 +1,8 @@
|
||||
using Google.Apis.Auth;
|
||||
using Google.Apis.Http;
|
||||
using System.Linq;
|
||||
using Google.Apis.Sheets.v4;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using WebAPI.dataParsers;
|
||||
using WebAPI.Exports;
|
||||
using WebAPI.Models;
|
||||
@@ -40,13 +31,22 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetAll(int start, int limit)
|
||||
public IActionResult GetAll(int start, int limit, [FromQuery] string[] codes)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(db.Layers.Where(x => !x.IsDeleted)
|
||||
.OrderByDescending(x => x.Number)
|
||||
.Skip(start).Take(limit).ToList());
|
||||
{
|
||||
if (codes != null && codes.Length > 0)
|
||||
{
|
||||
return Ok(db.Layers.Where(x => !x.IsDeleted)
|
||||
.Where(x => codes.Select(Int32.Parse).ToList().Contains(x.Number))
|
||||
.OrderByDescending(x => x.Number)
|
||||
.Skip(start).Take(limit).ToList());
|
||||
} else
|
||||
{
|
||||
return Ok(db.Layers.Where(x => !x.IsDeleted)
|
||||
.OrderByDescending(x => x.Number)
|
||||
.Skip(start).Take(limit).ToList());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user