using Back.Data.Contracts; using Back.Data.Models; using Microsoft.EntityFrameworkCore; using Shared.DTOs; namespace Back.Services { public class Servstuff { private readonly IAsyncRepository _repostuff; public Servstuff(IAsyncRepository repostuff) { _repostuff=repostuff; } public async Task> 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(); } } }