This commit is contained in:
mmrbnjd
2024-06-27 00:20:36 +03:30
parent 478456c03f
commit 94fdefa12c
8 changed files with 138 additions and 57 deletions

View File

@@ -1,7 +1,9 @@
using Back.Data.Contracts;
using Back.Common;
using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Shared.DTOs;
using Shared.DTOs.Serch;
namespace Back.Services
{
@@ -12,10 +14,24 @@ namespace Back.Services
{
_repostuff=repostuff;
}
public async Task<List<stuffDto>> Getstuff(string value)
public async Task<PagingDto<stuffDto>> Getstuff(GridDataProviderRequestDto value)
{
var request = _repostuff.Get(w => w.sType.Contains(value) || w.DescriptionOfID.Contains(value) || w.CID.Contains(value));
//Contains
var request = _repostuff.GetAll();
foreach (var item in value.Filters)
{
switch (item.PropertyName)
{
case "ID":
request = request.Where(w=>w.CID.Contains( item.Value));
break;
case "DescriptionOfID":
request = request.Where(w => w.DescriptionOfID.Contains(item.Value));
break;
default:
break;
}
}
return await request.Select(s=>new stuffDto
{
DescriptionOfID=s.DescriptionOfID,
@@ -25,7 +41,7 @@ namespace Back.Services
Vat= string.IsNullOrEmpty(s.Vat) ? 0 :Convert.ToInt32(s.Vat),
// VatCustomPurposes = string.IsNullOrEmpty(s.VatCustomPurposes) ? 0 : Convert.ToInt32(s.VatCustomPurposes)
}).ToListAsync();
}).Paging(value.PageNumber,value.PageSize);
}
}
}