23 lines
733 B
C#
23 lines
733 B
C#
using Back.Data.Contracts;
|
|
using Back.Services.Warehouse;
|
|
using FluentValidation;
|
|
using Shared.DTOs.Warehouse;
|
|
|
|
namespace Back.Validations.Warehouse.Remittance
|
|
{
|
|
public class DeleteValidation : AbstractValidator<Tuple<int, int>>
|
|
{
|
|
public DeleteValidation(IAsyncRepository<Back.Data.Models.Warehouse.Remittance> _Repo)
|
|
{
|
|
RuleFor(model => model)
|
|
.Custom((model, context) =>
|
|
{
|
|
var ORGitem = _Repo.Get(w => w.ID == model.Item1 && w.cODItem.CompanyID == model.Item2 && !w.Deleted).FirstOrDefault();
|
|
if (ORGitem == null)
|
|
context.AddFailure("حواله یافت نشد");
|
|
|
|
});
|
|
}
|
|
}
|
|
}
|