text: 'use strict';
  
  moduleAutor.controller('autorEditController', ['$scope', '$http', '$location', 'toolService', '$routeParams', 'sessionService',
      function ($scope, $http, $location, toolService, $routeParams, sessionService) {
          $scope.id = $routeParams.id;
          $scope.ob = "autor";
  
          $http({
              method: 'GET',
              url: '/json?ob=' + $scope.ob + '&op=get&id=' + $scope.id
          }).then(function (response) {
              $scope.status = response.status;
              $scope.ajaxDatoAutor = response.data.message;
          }, function (response) {
              $scope.ajaxDatoAutor = response.data.message || 'Request failed';
              $scope.status = response.status;
          });
  
  
          $scope.guardar = function () {
              var json = {
                  id: $scope.ajaxDatoAutor.id,
                  nombre: $scope.ajaxDatoAutor.nombre
              }
              $http({
                  method: 'GET',
                  withCredentials: true,
                  url: '/json?ob=' + $scope.ob + '&op=update',
                  params: {json: JSON.stringify(json)}
              }).then(function (response) {
                  $scope.status = response.status;
                  $scope.mensaje = true;
              }, function (response) {
                  $scope.ajaxDatoAutor = response.data.message || 'Request failed';
                  $scope.status = response.status;
              });
          };
          $scope.isActive = toolService.isActive;
  
      }]);