initial commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using Indotalent.ConfigBackEnd.Extensions;
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class CreatePurchaseOrderRequest
|
||||
{
|
||||
public DateTime? OrderDate { get; set; }
|
||||
public Data.Enums.PurchaseOrderStatus OrderStatus { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? VendorId { get; set; }
|
||||
public string? TaxId { get; set; }
|
||||
}
|
||||
|
||||
public class CreatePurchaseOrderResponse
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? AutoNumber { get; set; }
|
||||
}
|
||||
|
||||
public record CreatePurchaseOrderCommand(CreatePurchaseOrderRequest Data) : IRequest<CreatePurchaseOrderResponse>;
|
||||
|
||||
public class CreatePurchaseOrderHandler : IRequestHandler<CreatePurchaseOrderCommand, CreatePurchaseOrderResponse>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public CreatePurchaseOrderHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<CreatePurchaseOrderResponse> Handle(CreatePurchaseOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entityName = nameof(Data.Entities.PurchaseOrder);
|
||||
var autoNo = await _context.GenerateAutoNumberAsync(
|
||||
entityName: entityName,
|
||||
prefixTemplate: $"PO/{{Year}}/{{Month}}/",
|
||||
ct: cancellationToken
|
||||
);
|
||||
|
||||
var entity = new Data.Entities.PurchaseOrder
|
||||
{
|
||||
AutoNumber = autoNo,
|
||||
OrderDate = request.Data.OrderDate,
|
||||
OrderStatus = request.Data.OrderStatus,
|
||||
Description = request.Data.Description,
|
||||
VendorId = request.Data.VendorId,
|
||||
TaxId = request.Data.TaxId,
|
||||
BeforeTaxAmount = 0,
|
||||
TaxAmount = 0,
|
||||
AfterTaxAmount = 0
|
||||
};
|
||||
|
||||
_context.PurchaseOrder.Add(entity);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return new CreatePurchaseOrderResponse
|
||||
{
|
||||
Id = entity.Id,
|
||||
AutoNumber = entity.AutoNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Indotalent.Shared.Utils;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class CreatePurchaseOrderItemRequest
|
||||
{
|
||||
public string? PurchaseOrderId { get; set; }
|
||||
public string? ProductId { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public decimal? UnitPrice { get; set; }
|
||||
public double? Quantity { get; set; }
|
||||
}
|
||||
|
||||
public record CreatePurchaseOrderItemCommand(CreatePurchaseOrderItemRequest Data) : IRequest<bool>;
|
||||
|
||||
public class CreatePurchaseOrderItemHandler : IRequestHandler<CreatePurchaseOrderItemCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public CreatePurchaseOrderItemHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<bool> Handle(CreatePurchaseOrderItemCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = new Data.Entities.PurchaseOrderItem
|
||||
{
|
||||
PurchaseOrderId = request.Data.PurchaseOrderId,
|
||||
ProductId = request.Data.ProductId,
|
||||
Summary = request.Data.Summary,
|
||||
UnitPrice = request.Data.UnitPrice ?? 0,
|
||||
Quantity = request.Data.Quantity ?? 0,
|
||||
Total = (request.Data.UnitPrice ?? 0) * (decimal)(request.Data.Quantity ?? 0)
|
||||
};
|
||||
|
||||
_context.PurchaseOrderItem.Add(entity);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Data.PurchaseOrderId))
|
||||
{
|
||||
PurchaseOrderHelper.Recalculate(_context, request.Data.PurchaseOrderId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class CreatePurchaseOrderValidator : AbstractValidator<CreatePurchaseOrderRequest>
|
||||
{
|
||||
public CreatePurchaseOrderValidator()
|
||||
{
|
||||
RuleFor(x => x.OrderDate).NotEmpty().WithMessage("Date is required");
|
||||
RuleFor(x => x.VendorId).NotEmpty().WithMessage("Vendor is required");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public record DeletePurchaseOrderByIdCommand(string Id) : IRequest<bool>;
|
||||
|
||||
public class DeletePurchaseOrderByIdHandler : IRequestHandler<DeletePurchaseOrderByIdCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public DeletePurchaseOrderByIdHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<bool> Handle(DeletePurchaseOrderByIdCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = await _context.PurchaseOrder
|
||||
.FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
|
||||
|
||||
if (entity == null) return false;
|
||||
|
||||
_context.PurchaseOrder.Remove(entity);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Indotalent.Shared.Utils;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public record DeletePurchaseOrderItemCommand(string Id) : IRequest<bool>;
|
||||
|
||||
public class DeletePurchaseOrderItemHandler : IRequestHandler<DeletePurchaseOrderItemCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public DeletePurchaseOrderItemHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<bool> Handle(DeletePurchaseOrderItemCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = await _context.PurchaseOrderItem
|
||||
.FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
|
||||
|
||||
if (entity == null) return false;
|
||||
|
||||
var orderId = entity.PurchaseOrderId;
|
||||
|
||||
_context.PurchaseOrderItem.Remove(entity);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(orderId))
|
||||
{
|
||||
PurchaseOrderHelper.Recalculate(_context, orderId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class PurchaseOrderItemResponse
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? ProductId { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public decimal? UnitPrice { get; set; }
|
||||
public double? Quantity { get; set; }
|
||||
public decimal? Total { get; set; }
|
||||
}
|
||||
|
||||
public class GetPurchaseOrderByIdResponse
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? AutoNumber { get; set; }
|
||||
public DateTime? OrderDate { get; set; }
|
||||
public Data.Enums.PurchaseOrderStatus OrderStatus { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? VendorId { get; set; }
|
||||
public string? VendorName { get; set; }
|
||||
public string? VendorStreet { get; set; }
|
||||
public string? VendorCity { get; set; }
|
||||
public string? VendorState { get; set; }
|
||||
public string? VendorZipCode { get; set; }
|
||||
public string? VendorPhone { get; set; }
|
||||
public string? VendorEmail { get; set; }
|
||||
public string? VendorFax { get; set; }
|
||||
public string? CompanyName { get; set; }
|
||||
public string? CompanyStreet { get; set; }
|
||||
public string? CompanyCity { get; set; }
|
||||
public string? CompanyState { get; set; }
|
||||
public string? CompanyZipCode { get; set; }
|
||||
public string? CompanyPhone { get; set; }
|
||||
public string? CompanyEmail { get; set; }
|
||||
public string? CurrencySymbol { get; set; }
|
||||
public string? TaxId { get; set; }
|
||||
public decimal? BeforeTaxAmount { get; set; }
|
||||
public decimal? TaxAmount { get; set; }
|
||||
public decimal? AfterTaxAmount { get; set; }
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
public string? CreatedBy { get; set; }
|
||||
public DateTimeOffset? UpdatedAt { get; set; }
|
||||
public string? UpdatedBy { get; set; }
|
||||
public List<PurchaseOrderItemResponse> Items { get; set; } = new();
|
||||
}
|
||||
|
||||
public record GetPurchaseOrderByIdQuery(string Id) : IRequest<GetPurchaseOrderByIdResponse?>;
|
||||
|
||||
public class GetPurchaseOrderByIdHandler : IRequestHandler<GetPurchaseOrderByIdQuery, GetPurchaseOrderByIdResponse?>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public GetPurchaseOrderByIdHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<GetPurchaseOrderByIdResponse?> Handle(GetPurchaseOrderByIdQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var company = await _context.Company
|
||||
.AsNoTracking()
|
||||
.Include(x => x.Currency)
|
||||
.OrderByDescending(x => x.IsDefault)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
return await _context.PurchaseOrder
|
||||
.AsNoTracking()
|
||||
.Include(x => x.Vendor)
|
||||
.Include(x => x.PurchaseOrderItemList)
|
||||
.ThenInclude(x => x.Product)
|
||||
.Where(x => x.Id == request.Id)
|
||||
.Select(x => new GetPurchaseOrderByIdResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
AutoNumber = x.AutoNumber,
|
||||
OrderDate = x.OrderDate,
|
||||
OrderStatus = x.OrderStatus,
|
||||
Description = x.Description,
|
||||
VendorId = x.VendorId,
|
||||
VendorName = x.Vendor!.Name,
|
||||
VendorStreet = x.Vendor!.Street,
|
||||
VendorCity = x.Vendor!.City,
|
||||
VendorState = x.Vendor!.State,
|
||||
VendorZipCode = x.Vendor!.ZipCode,
|
||||
VendorPhone = x.Vendor!.PhoneNumber,
|
||||
VendorEmail = x.Vendor!.EmailAddress,
|
||||
VendorFax = x.Vendor!.FaxNumber,
|
||||
CompanyName = company != null ? company.Name : string.Empty,
|
||||
CompanyStreet = company != null ? company.StreetAddress : string.Empty,
|
||||
CompanyCity = company != null ? company.City : string.Empty,
|
||||
CompanyState = company != null ? company.StateProvince : string.Empty,
|
||||
CompanyZipCode = company != null ? company.ZipCode : string.Empty,
|
||||
CompanyPhone = company != null ? company.Phone : string.Empty,
|
||||
CompanyEmail = company != null ? company.Email : string.Empty,
|
||||
CurrencySymbol = company != null && company.Currency != null ? company.Currency.Symbol : "IDR",
|
||||
TaxId = x.TaxId,
|
||||
BeforeTaxAmount = x.BeforeTaxAmount,
|
||||
TaxAmount = x.TaxAmount,
|
||||
AfterTaxAmount = x.AfterTaxAmount,
|
||||
CreatedAt = x.CreatedAt,
|
||||
CreatedBy = x.CreatedBy,
|
||||
UpdatedAt = x.UpdatedAt,
|
||||
UpdatedBy = x.UpdatedBy,
|
||||
Items = x.PurchaseOrderItemList.Select(i => new PurchaseOrderItemResponse
|
||||
{
|
||||
Id = i.Id,
|
||||
ProductId = i.ProductId,
|
||||
ProductName = i.Product!.Name,
|
||||
Summary = i.Summary,
|
||||
UnitPrice = i.UnitPrice,
|
||||
Quantity = i.Quantity,
|
||||
Total = i.Total
|
||||
}).ToList()
|
||||
}).FirstOrDefaultAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class GetPurchaseOrderListResponse
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? AutoNumber { get; set; }
|
||||
public DateTime? OrderDate { get; set; }
|
||||
public string? VendorName { get; set; }
|
||||
public decimal? AfterTaxAmount { get; set; }
|
||||
public Data.Enums.PurchaseOrderStatus OrderStatus { get; set; }
|
||||
}
|
||||
|
||||
public record GetPurchaseOrderListQuery() : IRequest<List<GetPurchaseOrderListResponse>>;
|
||||
|
||||
public class GetPurchaseOrderListHandler : IRequestHandler<GetPurchaseOrderListQuery, List<GetPurchaseOrderListResponse>>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public GetPurchaseOrderListHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<List<GetPurchaseOrderListResponse>> Handle(GetPurchaseOrderListQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.PurchaseOrder
|
||||
.AsNoTracking()
|
||||
.Include(x => x.Vendor)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(x => new GetPurchaseOrderListResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
AutoNumber = x.AutoNumber,
|
||||
OrderDate = x.OrderDate,
|
||||
VendorName = x.Vendor!.Name,
|
||||
AfterTaxAmount = x.AfterTaxAmount,
|
||||
OrderStatus = x.OrderStatus
|
||||
}).ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Indotalent.Data.Enums;
|
||||
using Indotalent.ConfigBackEnd.Extensions;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class PurchaseOrderLookupResponse
|
||||
{
|
||||
public List<LookupItem> Vendors { get; set; } = new();
|
||||
public List<LookupItem> Taxes { get; set; } = new();
|
||||
public List<LookupItem> Products { get; set; } = new();
|
||||
public List<LookupStatusItem> Statuses { get; set; } = new();
|
||||
}
|
||||
|
||||
public class LookupItem
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
public class LookupStatusItem
|
||||
{
|
||||
public int Value { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
public record GetPurchaseOrderLookupQuery() : IRequest<PurchaseOrderLookupResponse>;
|
||||
|
||||
public class GetPurchaseOrderLookupHandler : IRequestHandler<GetPurchaseOrderLookupQuery, PurchaseOrderLookupResponse>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public GetPurchaseOrderLookupHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<PurchaseOrderLookupResponse> Handle(GetPurchaseOrderLookupQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = new PurchaseOrderLookupResponse();
|
||||
|
||||
response.Vendors = await _context.Vendor.AsNoTracking()
|
||||
.OrderBy(x => x.Name)
|
||||
.Select(x => new LookupItem { Id = x.Id, Name = x.Name })
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
response.Taxes = await _context.Tax.AsNoTracking()
|
||||
.OrderBy(x => x.Name)
|
||||
.Select(x => new LookupItem { Id = x.Id, Name = x.Name })
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
response.Products = await _context.Product.AsNoTracking()
|
||||
.OrderBy(x => x.Name)
|
||||
.Select(x => new LookupItem { Id = x.Id, Name = x.Name })
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
response.Statuses = Enum.GetValues(typeof(PurchaseOrderStatus))
|
||||
.Cast<PurchaseOrderStatus>()
|
||||
.Select(x => new LookupStatusItem
|
||||
{
|
||||
Value = (int)x,
|
||||
Name = x.GetDescription()
|
||||
}).ToList();
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Indotalent.Shared.Utils;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class UpdatePurchaseOrderRequest
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public DateTime? OrderDate { get; set; }
|
||||
public Data.Enums.PurchaseOrderStatus OrderStatus { get; set; }
|
||||
public string? AutoNumber { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? VendorId { get; set; }
|
||||
public string? TaxId { get; set; }
|
||||
public decimal? BeforeTaxAmount { get; set; }
|
||||
public decimal? TaxAmount { get; set; }
|
||||
public decimal? AfterTaxAmount { get; set; }
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
public string? CreatedBy { get; set; }
|
||||
public DateTimeOffset? UpdatedAt { get; set; }
|
||||
public string? UpdatedBy { get; set; }
|
||||
}
|
||||
|
||||
public record UpdatePurchaseOrderCommand(UpdatePurchaseOrderRequest Data) : IRequest<bool>;
|
||||
|
||||
public class UpdatePurchaseOrderHandler : IRequestHandler<UpdatePurchaseOrderCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public UpdatePurchaseOrderHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<bool> Handle(UpdatePurchaseOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = await _context.PurchaseOrder
|
||||
.FirstOrDefaultAsync(x => x.Id == request.Data.Id, cancellationToken);
|
||||
|
||||
if (entity == null) return false;
|
||||
|
||||
entity.OrderDate = request.Data.OrderDate;
|
||||
entity.OrderStatus = request.Data.OrderStatus;
|
||||
entity.Description = request.Data.Description;
|
||||
entity.VendorId = request.Data.VendorId;
|
||||
entity.TaxId = request.Data.TaxId;
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(entity.Id))
|
||||
{
|
||||
PurchaseOrderHelper.Recalculate(_context, entity.Id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Indotalent.Shared.Utils;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class UpdatePurchaseOrderItemRequest
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? ProductId { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public decimal? UnitPrice { get; set; }
|
||||
public double? Quantity { get; set; }
|
||||
}
|
||||
|
||||
public record UpdatePurchaseOrderItemCommand(UpdatePurchaseOrderItemRequest Data) : IRequest<bool>;
|
||||
|
||||
public class UpdatePurchaseOrderItemHandler : IRequestHandler<UpdatePurchaseOrderItemCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public UpdatePurchaseOrderItemHandler(AppDbContext context) => _context = context;
|
||||
|
||||
public async Task<bool> Handle(UpdatePurchaseOrderItemCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = await _context.PurchaseOrderItem
|
||||
.FirstOrDefaultAsync(x => x.Id == request.Data.Id, cancellationToken);
|
||||
|
||||
if (entity == null) return false;
|
||||
|
||||
entity.ProductId = request.Data.ProductId;
|
||||
entity.Summary = request.Data.Summary;
|
||||
entity.UnitPrice = request.Data.UnitPrice ?? 0;
|
||||
entity.Quantity = request.Data.Quantity ?? 0;
|
||||
entity.Total = (request.Data.UnitPrice ?? 0) * (decimal)(request.Data.Quantity ?? 0);
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
if (!string.IsNullOrEmpty(entity.PurchaseOrderId))
|
||||
{
|
||||
PurchaseOrderHelper.Recalculate(_context, entity.PurchaseOrderId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Indotalent.Features.Purchase.PurchaseOrder.Cqrs;
|
||||
|
||||
public class UpdatePurchaseOrderValidator : AbstractValidator<UpdatePurchaseOrderRequest>
|
||||
{
|
||||
public UpdatePurchaseOrderValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.VendorId).NotEmpty().WithMessage("Vendor is required");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user