常用方法
常用方法
常用方法
常用方法
public static IRuleBuilderOptions <T, string> ExisteClienteComId <T>(this IRuleBuilder <T, string> ruleBuilder, IClientesRepository clientesRepository) { return(ruleBuilder.MustAsync(async(id, b) => { if (!Guid.TryParse(id, out Guid clienteId)) { return false; } return await clientesRepository.ExistsAsync(clienteId); }).WithMessage("O cliente informado não existe")); }