...
This commit is contained in:
31
Back/Services/Servstuff.cs
Normal file
31
Back/Services/Servstuff.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class Servstuff
|
||||
{
|
||||
private readonly IAsyncRepository<stuff> _repostuff;
|
||||
public Servstuff(IAsyncRepository<stuff> repostuff)
|
||||
{
|
||||
_repostuff=repostuff;
|
||||
}
|
||||
public async Task<List<stuffDto>> Getstuff(string value)
|
||||
{
|
||||
var request = _repostuff.Get(w => w.sType.Contains(value) || w.DescriptionOfID.Contains(value) || w.CID.Contains(value));
|
||||
|
||||
return await request.Select(s=>new stuffDto
|
||||
{
|
||||
DescriptionOfID=s.DescriptionOfID,
|
||||
ID=string.IsNullOrEmpty(s.CID) ? 0 :Convert.ToUInt64(s.CID),
|
||||
TaxableOrFree=s.TaxableOrFree,
|
||||
Type=s.sType,
|
||||
Vat= string.IsNullOrEmpty(s.Vat) ? 0 :Convert.ToInt32(s.Vat),
|
||||
// VatCustomPurposes = string.IsNullOrEmpty(s.VatCustomPurposes) ? 0 : Convert.ToInt32(s.VatCustomPurposes)
|
||||
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user