protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value == null) { return(new ValidationResult("Digite o CPF!")); } string cpf = (value as string).Trim(); IClienteServices clienteRepos = (IClienteServices)validationContext.GetService(typeof(IClienteServices)); List <Cliente> clientes = clienteRepos.GetUserByCPFAsync(cpf).Result; ClienteDTO objCliente = (ClienteDTO)validationContext.ObjectInstance; if (clientes.Count > 1) { return(new ValidationResult("CPF já existente!")); } if (clientes.Count == 1 && objCliente.CPF != clientes.First().CPF) { return(new ValidationResult("CPF já existente!")); } return(ValidationResult.Success); }
public UsersController( IClienteServices userService, IOptions <AppSettings> appSettings) { _userService = userService; _appSettings = appSettings.Value; }
public static void AtualizarCliente(IClienteServices clienteService) { Console.Clear(); Console.Write("Digite o id do cliente que deseja atualizar: "); var idString = Console.ReadLine(); int?id; if (idString == string.Empty) { id = null; } else { id = int.Parse(idString); } var cliente = clienteService.ObterClientes(id).First(); Console.WriteLine(cliente); Console.Write("Digite o novo nome(digite nada para não alterar): "); string nome = Console.ReadLine(); Console.Write("Digite o novo login(digite nada para não alterar): "); string login = Console.ReadLine(); Console.Write("Digite a nova senha(digite nada para não alterar): "); string senha = Console.ReadLine(); nome = nome != string.Empty ? nome : cliente.Nome; login = login != string.Empty ? login : cliente.Login; senha = senha != string.Empty ? senha : cliente.Senha; Console.WriteLine(clienteService.AtualizarCliente(id.Value, nome, login, senha)); }
public EmprestimoServices(IEmprestimoRepository emprestimoRepository, IClienteServices clienteServices, IEmprestimoBuilder emprestimoBuilder, IValidator <EmprestimoFormDto> validatorFormDto) { _emprestimoRepository = emprestimoRepository; _clienteServices = clienteServices; _emprestimoBuilder = emprestimoBuilder; _validatorFormDto = validatorFormDto; }
public ActionResult Delete([FromServices] IClienteServices clienteServices, int id) { try { clienteServices.DeleteClienteById(id); return(Ok()); } catch (Exception ex) { _logger.LogError(ex.Message, ex); return(Problem(ex.Message)); } }
public ActionResult Put([FromServices] IClienteServices clienteServices, [FromBody] Cliente cliente) { try { clienteServices.SalvarCliente(cliente); return(Ok()); } catch (Exception ex) { _logger.LogError(ex.Message, ex); return(Problem(ex.Message)); } }
public ActionResult GetAll([FromServices] IClienteServices clienteServices) { try { var cliente = clienteServices.GetAllCliente().ToList(); return(Ok(cliente)); } catch (Exception ex) { _logger.LogError(ex.Message, ex); return(Problem(ex.Message)); } }
public ActionResult Get([FromServices] IClienteServices clienteServices, long id) { try { var cliente = clienteServices.GetClienteById(id); return(Ok(cliente)); } catch (Exception ex) { _logger.LogError(ex.Message, ex); return(Problem(ex.Message)); } }
public static void DeletarCliente(IClienteServices clienteService) { Console.Clear(); Console.Write("Digite o id do cliente que deseja deletar: "); var idString = Console.ReadLine(); int?id; if (idString == string.Empty) { id = null; } else { id = int.Parse(idString); } Console.WriteLine(clienteService.DeletarCliente(id)); }
public static void CadastrarCliente(IClienteServices clienteService) { Console.Clear(); Console.Write("Digite o id: "); int id = int.Parse(Console.ReadLine()); Console.Write("Digite o nome: "); string nome = Console.ReadLine(); Console.Write("Digite o login: "******"Digite a senha: "); string senha = Console.ReadLine(); var cliente = clienteService.CadastrarCliente(id, nome, login, senha); Console.WriteLine(cliente); }
public static void ObterCliente(IClienteServices clienteService) { Console.Clear(); Console.Write("Informe o id, caso queria um cliente específico: "); var idString = Console.ReadLine(); int?id; if (idString == string.Empty) { id = null; } else { id = int.Parse(idString); } var clientes = clienteService.ObterClientes(id); foreach (Cliente x in clientes) { Console.WriteLine(x); } }
public Form1(IClienteServices clienteServices) { InitializeComponent(); _clienteServices = clienteServices; }
public VidaRealController(IClienteServices clienteServices) { _clienteServices = clienteServices; }
public ClienteController(IClienteServices clienteServices) { _clienteServices = clienteServices; }
public TesteDip() { _cliService = new ClienteServices(new EmailServices(), new ClienteRepository()); }
public void Index([FromServices] IClienteServices clienteServices) { clienteServices.AdicionarCliente(new Cliente()); }
public ClientesController(IClientes cliente, IHttpClientFactory client, IClienteServices clienteSvc) { _client = cliente; _httpClient = client.CreateClient("AltioraService"); _clienteSvc = clienteSvc; }
public ClienteController(IClienteServices _clienteServices) { this.clienteServices = _clienteServices; }
public ClienteController(IClienteServices prmClienteServices, ILogger <ClienteController> logger, IOptions <AppSettings> settings) { clienteServices = prmClienteServices; _logger = logger; }
public HomeController(ILogger <HomeController> logger, IClienteServices _clienteServices) { _logger = logger; _ClienteServices = _clienteServices; }
public ClienteController(IClienteServices clienteServices, IEmprestimoServices emprestimoServices) { _clienteServices = clienteServices; _emprestimoServices = emprestimoServices; }
public ClienteController(IClienteServices services, IMapper mapper) { _services = services; _mapper = mapper; }
public ClientesController(IClienteServices service) { _service = service; }
public ClientesController(IClienteServices IClienteServices) { _IClienteServices = IClienteServices; }
public DeleteModel(IClienteServices clienteServices) { _clienteServices = clienteServices; }
public ClienteAppServices(IClienteServices clienteServices, IMapperServices mapper) { _clienteServices = clienteServices; _mapper = mapper; }
public ClientesController(IClienteServices clienteServices, IMapper mapper) { _clienteServices = clienteServices; _mapper = mapper; }
public ClienteController(IClienteServices clienteServices, IUsuarioServices usuarioServices) { this.clienteServices = clienteServices; this.usuarioServices = usuarioServices; }
public ClienteController(ILogger <ClienteController> logger, IClienteServices clienteServices) { _logger = logger; _clienteServices = clienteServices; }