32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|