...
This commit is contained in:
45
Back/Services/servInvoicePayment.cs
Normal file
45
Back/Services/servInvoicePayment.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class servInvoicePayment
|
||||
{
|
||||
private readonly IAsyncRepository<InvoicePayment> _Repo;
|
||||
public servInvoicePayment(IAsyncRepository<InvoicePayment> Repo)
|
||||
{
|
||||
_Repo = Repo;
|
||||
}
|
||||
public async Task<bool> Add(InvoicePayment item)
|
||||
{
|
||||
return await _Repo.AddBoolResultAsync(item);
|
||||
}
|
||||
public async Task<bool> Update(InvoicePayment item)
|
||||
{
|
||||
return await _Repo.UpdateAsync(item);
|
||||
}
|
||||
public async Task<bool> Delete(InvoicePayment item)
|
||||
{
|
||||
return await _Repo.DeleteAsync(item);
|
||||
}
|
||||
public async Task<bool> Exist(int companyID, int invoiceID, int ID)
|
||||
{
|
||||
return await _Repo.Get(w => w.InvoiceID == invoiceID && w.ID == ID && w.invoice.CompanyID == companyID).AnyAsync();
|
||||
}
|
||||
public async Task<InvoicePayment?> GetinvoicePay(int CompanyID, int ID)
|
||||
{
|
||||
return await _Repo
|
||||
.Get(w => w.ID == ID && w.invoice.CompanyID == CompanyID && !w.invoice.IsDeleted)
|
||||
.Include(s=>s.invoice)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<InvoicePayment> GetInvoicePayByInvoicePayID (int companyID, int invoiceID, int ID)
|
||||
{
|
||||
return await _Repo.Get(w => w.InvoiceID == invoiceID && w.ID == ID && w.invoice.CompanyID == companyID).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user