public IHttpActionResult Login(string usuario, string clave) { try { LoggerHelper.LogInfo(System.Reflection.MethodBase.GetCurrentMethod(), string.Format("Login usuario: {0} - clave: {1}", usuario, clave)); ServicioClientes servicio = new ServicioClientes(); Cliente resp = servicio.ClienteLogIn(usuario, clave); if (resp == null) { return(NotFound()); } LoggerHelper.LogInfo(System.Reflection.MethodBase.GetCurrentMethod(), JsonConvert.SerializeObject(resp)); return(Ok(resp)); } catch (ApplicationException ex) { LoggerHelper.LogError(MethodBase.GetCurrentMethod(), ex); return(BadRequest(ex.Message)); } catch (Exception ex) { LoggerHelper.LogError(MethodBase.GetCurrentMethod(), ex); return(BadRequest("Ocurrió un error al validar el usuario.")); } }
// POST api/cliente public IHttpActionResult Post([FromBody] Cliente datos) { try { ServicioClientes servicio = new ServicioClientes(); LoggerHelper.LogInfo(System.Reflection.MethodBase.GetCurrentMethod(), JsonConvert.SerializeObject(datos)); Cliente resp = servicio.ClienteGrabar(datos); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (ApplicationException ex) { LoggerHelper.LogError(MethodBase.GetCurrentMethod(), ex); LoggerHelper.LogError(System.Reflection.MethodBase.GetCurrentMethod(), JsonConvert.SerializeObject(datos)); return(BadRequest(ex.Message)); } catch (Exception) { return(BadRequest("El cliente no se pudo actualizar.")); } }
public IHttpActionResult Post([FromBody] Cliente datos) { try { ServicioClientes servicio = new ServicioClientes(); servicio.ClienteLogOut(datos.Id); return(Ok()); } catch (Exception ex) { LoggerHelper.LogError(MethodBase.GetCurrentMethod(), ex); return(BadRequest(ex.Message)); } }
public static void CargarDatosComboClientes(ref ComboBox combo) { IServicioClientes servicio = new ServicioClientes(); var lista = servicio.GetLista(null, null); var defaultCliente = new ClienteListDto() { ClienteId = 0, NombreCompania = "Seleccione Cliente" }; lista.Insert(0, defaultCliente); combo.DataSource = lista; combo.ValueMember = "ClienteId"; combo.DisplayMember = "NombreCompania"; combo.SelectedIndex = 0; }
public IHttpActionResult GetClientesSinLista() { try { ServicioClientes servicio = new ServicioClientes(); List <Cliente> resp = servicio.ClienteBusqueda(string.Empty, true); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetBuscar(string buscar) { try { ServicioClientes servicio = new ServicioClientes(); List <Cliente> resp = servicio.ClienteBusqueda(buscar, false); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult ListaPrecioCliente(int id) { try { ServicioClientes servicio = new ServicioClientes(); ClienteLista resp = servicio.ClienteListaEliminar(id); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
// GET api/cliente/5 public IHttpActionResult Get(int id) { try { ServicioClientes servicio = new ServicioClientes(); Cliente resp = servicio.ClienteObtener(id); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetBuscarAutocompletar(string buscar) { try { ServicioClientes servicio = new ServicioClientes(); List <string> resp = servicio.ClienteBusqueda(buscar, false) .OrderBy(item => item.Email) .Select(item => item.ClienteList) .ToList <string>(); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult ListaPrecioCliente([FromBody] ClienteLista datos) { try { ServicioClientes servicio = new ServicioClientes(); ClienteLista resp = servicio.ClienteListaGrabar(datos); if (resp == null) { return(NotFound()); } return(Ok(resp)); } catch (ApplicationException ex) { return(BadRequest(ex.Message)); } catch (Exception) { return(BadRequest("La lista de precios para el cliente no se pudo actualizar.")); } }
public StandController() { servicioCampanas = new ServicioCampanas(); servicioClientes = new ServicioClientes(); servicioStands = new ServicioStands(); }
// GET: Administrativa/Clientes public ClientesController() { servicioClientes = new ServicioClientes(); }
public LogInController(IConfiguration config, ServicioClientes servicioClientes) { _config = config; _servicioCliente = servicioClientes; }