Example #1
0
        public async Task <IActionResult> RegistraCliente(Cliente cliente)
        {
            try
            {
                var ip = HttpContext.Connection.RemoteIpAddress.ToString();
                _logger.LogInformation("Usuario: {0} IP: {1} Device: {2}", "", ip, "");//, ((uniqueDevice is null) ? "" : uniqueDevice));

                if (cliente.sistema != 1 && cliente.sistema != 2 && cliente.sistema != 3 && cliente.sistema != 4)
                {
                    throw new Exception("ERROR AL DETERMINAR SISTEMA ...");
                }

                dynamic respuesta = new ExpandoObject();
                /*Entities.JsonResult*/ respuesta = await _registroService.RegistraCliente(cliente);

                if (respuesta.error == 1)
                {
                    throw new Exception(respuesta.result);
                }

                return(Ok(respuesta));
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                return(Helpers.ExceptionErrors.Exception(e.Class, string.Format("{0}.", e.Message), e));
            }
            catch (Exception e)
            {
                return(Helpers.ExceptionErrors.Exception(Helpers.ExceptionErrors.RESPONSE_INTERNAL_SERVER_ERROR, string.Format("ERROR {0}.", e.Message), e));
            }
        }