...
This commit is contained in:
22
Back/Validations/Warehouse/Remittance/DeleteValidation.cs
Normal file
22
Back/Validations/Warehouse/Remittance/DeleteValidation.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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("حواله یافت نشد");
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user