Ejemplo n.º 1
0
        public string  eliminaFoto(string identificador, int photo)
        {
            pictureManagerService pictureService = new pictureManagerService();


            List <Foto> lista_photos = new List <Foto>();
            string      contenido    = "";
            string      result       = "";

            lista_photos = pictureService.getFotos(identificador);


            foreach (var photos in lista_photos)
            {
                string urlfotos = photos.url_general;
                if (photos.id == photo)
                {
                    pictureService.delFoto(identificador, photo);
                    pictureService.eliminarFoto(photos.path_general);
                }
                else
                {
                    contenido = contenido + "{" +
                                "\"name\":\"" + photos.item_id + "_" + photos.num_photo + "_50.jpg\"," +
                                "\"size\":902604," +
                                "\"url\":\"" + urlfotos.Replace("_original.", "_zoom.") + "\"," +
                                "\"thumbnail_url\":\"" + urlfotos.Replace("_original.", "_60.") + "\"," +
                                "\"delete_url\":\"/home/process_picture/" + photos.item_id + "/?option=delete&photo=" + photos.num_photo + "\"," +
                                "\"delete_type\":\"GET\"" +
                                "},";
                }
            }

            if (contenido.Length > 0)
            {
                contenido = "[" + contenido + "]";
                contenido = contenido.Replace(",]", "]");
            }

            result = contenido;
            return(result);
        }
        public string  eliminaFoto( string identificador, int photo)
        {
            pictureManagerService pictureService = new pictureManagerService();
            

            List<Foto> lista_photos = new List<Foto>();
            string contenido = "";
            string result = "";

            lista_photos = pictureService.getFotos(identificador);
           

            foreach (var photos in lista_photos)
            {
                string urlfotos = photos.url_general;
                if (photos.id == photo)
                {
                    pictureService.delFoto(identificador, photo);
                    pictureService.eliminarFoto(photos.path_general);
                }
                else
                {
                contenido = contenido + "{" +
                                                 "\"name\":\"" + photos.item_id + "_" + photos.num_photo + "_50.jpg\"," +
                                                 "\"size\":902604," +
                                                 "\"url\":\"" + urlfotos.Replace("_original.", "_zoom.") + "\"," +
                                                 "\"thumbnail_url\":\"" + urlfotos.Replace("_original.", "_60.") + "\"," +
                                                 "\"delete_url\":\"/home/process_picture/" + photos.item_id + "/?option=delete&photo=" + photos.num_photo + "\"," +
                                                 "\"delete_type\":\"GET\"" +
                                                 "},";

                }
                
               

            }

            if (contenido.Length > 0)
            {
                contenido = "[" + contenido + "]";
                contenido = contenido.Replace(",]", "]");
            }

            result = contenido;
            return result;
        }