...
This commit is contained in:
32
Back/Services/servInvoiceItem.cs
Normal file
32
Back/Services/servInvoiceItem.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class servInvoiceItem
|
||||
{
|
||||
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
|
||||
public servInvoiceItem(IAsyncRepository<InvoiceItem> invoiceitemRepo)
|
||||
{
|
||||
_invoiceitemRepo = invoiceitemRepo;
|
||||
}
|
||||
public async Task<bool> Add(InvoiceItem item)
|
||||
{
|
||||
return await _invoiceitemRepo.AddBoolResultAsync(item);
|
||||
}
|
||||
public async Task<bool> Update(InvoiceItem item)
|
||||
{
|
||||
return await _invoiceitemRepo.UpdateAsync(item);
|
||||
}
|
||||
public async Task<bool> Exist(int companyID,int invoiceID,int invoiceitemID)
|
||||
{
|
||||
return await _invoiceitemRepo.Get(w => w.InvoiceID == invoiceID && w.ID == invoiceitemID && w.invoice.CompanyID == companyID).AnyAsync();
|
||||
}
|
||||
|
||||
public async Task<InvoiceItem> Getinvoiceitem(int companyID, int invoiceID, int invoiceitemID)
|
||||
{
|
||||
return await _invoiceitemRepo.Get(w => w.InvoiceID == invoiceID && w.ID == invoiceitemID && w.invoice.CompanyID == companyID).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user