Exemplo n.º 1
0
        private WSEditorial parseModelWS(Editorial editorial)
        {
            WSEditorial wSEditorial = new WSEditorial();

            wSEditorial.nombre = editorial.Nombre;
            return(wSEditorial);
        }
Exemplo n.º 2
0
        private Editorial parseWSEditorialToEditorial(WSEditorial editorial)
        {
            Editorial aux = new Editorial();

            aux.Nombre = editorial.Nombre;
            return(aux);
        }
Exemplo n.º 3
0
        private Editorial parseWSModel(WSEditorial WSEditorial)
        {
            Editorial editorial = new Editorial();

            editorial.Nombre = WSEditorial.nombre;
            return(editorial);
        }
Exemplo n.º 4
0
        public WSEditorial GetById(int codEditorial)
        {
            Editorial   editorial   = eS.getById(codEditorial);
            WSEditorial wsEditorial = new WSEditorial();

            wsEditorial = parseModelWS(editorial);
            return(wsEditorial);
        }
Exemplo n.º 5
0
        public List <WSEditorial> GetAll()
        {
            IList <Editorial>  editoriales   = eS.getAll();
            List <WSEditorial> WSeditoriales = new List <WSEditorial>();
            WSEditorial        wsEditorial   = null;

            foreach (Editorial ed in editoriales)
            {
                wsEditorial = parseModelWS(ed);
                WSeditoriales.Add(wsEditorial);
            }
            return(WSeditoriales);
        }
Exemplo n.º 6
0
        public List <WSEditorial> getAll()
        {
            IList <Editorial>  listaEditoriales   = eS.getAll();
            List <WSEditorial> listaWSEditoriales = new List <WSEditorial>();
            WSEditorial        wsEditorial        = new WSEditorial();

            foreach (var editorial in listaEditoriales)
            {
                editorial.CodEditorial = wsEditorial.Codigo;
                editorial.Nombre       = wsEditorial.Nombre;
                listaWSEditoriales.Add(wsEditorial);
            }
            return(listaWSEditoriales);
        }
Exemplo n.º 7
0
        public string update(WSEditorial editorial)
        {
            string resultado = "";

            if (eS.getById(editorial.Codigo) != null)
            {
                eS.update(parseWSEditorialToEditorial(editorial));
                resultado = "La Editorial se ha actualizado correctamente";
            }
            else
            {
                resultado = "No se ha encontrado la Editorial";
            }
            return(resultado);
        }
Exemplo n.º 8
0
        public string create(WSEditorial editorial)
        {
            string resultado = "";

            if (eS.getById(editorial.Codigo) == null)
            {
                eS.create(parseWSEditorialToEditorial(editorial));
                resultado = "Editorial creado";
            }
            else
            {
                resultado = "No se ha podido crear la Editorial";
            }
            return(resultado);
        }
Exemplo n.º 9
0
        public WSEditorial getEditorialById(int idEditorial)
        {
            WSEditorial wsEditorial = new WSEditorial();
            Editorial   editAux     = eS.getById(idEditorial);

            if (editAux == null)
            {
                wsEditorial.ErrorMessage = "La Editorial no existe";
                throw new Exception();
            }
            else
            {
                wsEditorial.Nombre = editAux.Nombre;
            }
            return(wsEditorial);
        }
Exemplo n.º 10
0
        public string Update(WSEditorial WSEditorial)
        {
            Editorial editorial   = parseWSModel(WSEditorial);
            string    response    = null;
            Editorial editorialDV = eS.update(editorial);

            if (editorialDV != null)
            {
                response = "Se ha modificado correctamente";
            }
            else
            {
                response = "no se ha creado correctamente";
            }
            return(response);
        }
Exemplo n.º 11
0
        public string Create(WSEditorial WSEditorial)
        {
            Editorial editorial   = parseWSModel(WSEditorial);
            Editorial editorialDv = eS.create(editorial);
            string    response    = null;

            if (editorialDv != null)
            {
                response = "Se ha creado correctamente";
            }
            else
            {
                response = "No se ha creado";
            }
            return(response);
        }