예제 #1
0
        public IActionResult Get(int id)
        {
            ClienteIndOutput data = new ClienteIndOutput();

            data = productRepository.GetByID(id);

            if (data.status.Equals(Status.Error))
            {
                return(NotFound(data));
            }
            return(Ok(data));
        }
예제 #2
0
        public ClienteIndOutput GetByID(int id)
        {
            ClienteIndOutput clienteId = new ClienteIndOutput();

            clienteId = productRepository.GetByID(id);

            if (clienteId != null)
            {
                clienteId.message = "";
                clienteId.status  = Status.Ok;
            }
            else
            {
                clienteId         = new ClienteIndOutput();
                clienteId.message = "No existe cliente";
                clienteId.status  = Status.Error;
            }
            return(clienteId);
        }
예제 #3
0
        public ClienteIndOutput GetByID(int id)
        {
            ClienteIndOutput entidad = new ClienteIndOutput();

            using (IDatabase db = Connection)
            {
                try
                {
                    entidad = db.SingleOrDefault <ClienteIndOutput>("SELECT IdCliente as id, Nombre as nombre, Apellido as apellido FROM Cliente where eliminado =0 and IdCliente=@0", id);
                }
                catch
                {
                }
                finally
                {
                    db.CloseSharedConnection();
                }
            }

            return(entidad);
        }