Fix Isactive issue

This commit is contained in:
2026-09-09 16:30:38 +05:30
parent f9e4bb3a97
commit eb0303fa3f
3 changed files with 5 additions and 5 deletions
@@ -19,8 +19,7 @@ public class SupplierService(
public async Task<SupplierResponse?> GetByIdAsync(Guid id)
{
var supplier = await repo.GetByIdAsync(id);
if (supplier is null || !supplier.IsActive) return null;
return Map(supplier);
return supplier is null ? null : Map(supplier);
}
public async Task<SupplierResponse> CreateAsync(CreateSupplierRequest request, CancellationToken ct = default)
@@ -41,10 +40,11 @@ public class SupplierService(
public async Task<SupplierResponse?> UpdateAsync(Guid id, UpdateSupplierRequest request, CancellationToken ct = default)
{
var supplier = await repo.GetByIdAsync(id);
if (supplier is null || !supplier.IsActive) return null;
if (supplier is null) return null;
supplier.Name = request.Name;
supplier.ContactInfo = request.ContactInfo;
supplier.IsActive = request.IsActive;
await uow.BeginAsync(ct);
try { repo.Update(supplier); await uow.CommitAsync(ct); }