26 lines
745 B
C#
26 lines
745 B
C#
using Distribution.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Distribution.Features.Supplier;
|
|
|
|
public class SupplierRepository(AppDBContext context) : ISupplierRepository
|
|
{
|
|
public async Task<Models.Supplier?> GetByIdAsync(Guid id) =>
|
|
await context.Suppliers.FindAsync(id);
|
|
|
|
public async Task<List<Models.Supplier>> GetAllAsync() =>
|
|
await context.Suppliers.ToListAsync();
|
|
|
|
public async Task AddAsync(Models.Supplier entity) =>
|
|
await context.Suppliers.AddAsync(entity);
|
|
|
|
public void Update(Models.Supplier entity) =>
|
|
context.Suppliers.Update(entity);
|
|
|
|
public void Remove(Models.Supplier entity)
|
|
{
|
|
entity.IsActive = false;
|
|
context.Suppliers.Update(entity);
|
|
}
|
|
}
|