Пример #1
0
        /// <summary>
        /// Guarda la ruta de un video en youtube
        /// </summary>
        /// <param name="rutaYoutube"></param>
        private int GuardarRutaYoutube(string rutaYoutube)
        {
            try
            {
                string   videoId   = "";
                string[] rutaArray = rutaYoutube.Split("watch?v=");
                if (rutaArray != null)
                {
                    if (rutaArray.Length >= 2)
                    {
                        rutaArray = rutaArray[1].Split('&');
                        videoId   = rutaArray[0];
                    }
                    else
                    {
                        throw new NegocioExecption("Haz copiado mal la url del video, revisala bien", 500);
                    }
                }
                else
                {
                    throw new NegocioExecption("Ha ocurrido un error en el servidor al guardar el video", 500);
                }

                ImagenesDto videosDto = new ImagenesDto()
                {
                    Estado        = true,
                    Fechacreacion = DateTime.Now,
                    Nombre        = videoId,
                    Ruta          = rutaYoutube
                };
                Imagenes video = mapper.Map <Imagenes>(videosDto);
                this.repository.GuardarImagenPost(video);

                return(video.Idimagen);
            }
            catch (NegocioExecption)
            {
                throw;
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
 /// <summary>
 /// Guarda la ruta del podcast en la bd
 /// </summary>
 /// <param name="ruta"></param>
 /// <returns></returns>
 private void GuardarAudioPodcast(string ruta)
 {
     try
     {
         ImagenesDto imagenesDto = new ImagenesDto()
         {
             Estado        = true,
             Fechacreacion = DateTime.Now,
             Nombre        = ruta,
             Ruta          = ruta
         };
         Imagenes imagenes = mapper.Map <Imagenes>(imagenesDto);
         this.repository.GuardarImagenPost(imagenes);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 /// <summary>
 /// Guarda la ruta de la imagen en la bd
 /// </summary>
 /// <param name="ruta"></param>
 /// <returns></returns>
 private void GuardarImagenContenido(PrincipalDto principalDto)
 {
     try
     {
         ImagenesDto imagenesDto = new ImagenesDto()
         {
             Estado        = true,
             Fechacreacion = DateTime.Now,
             Nombre        = principalDto.Texto,
             Ruta          = principalDto.RutaImagen
         };
         Imagenes imagenes = mapper.Map <Imagenes>(imagenesDto);
         this.blogRepository.GuardarImagenPost(imagenes);
     }
     catch (Exception)
     {
         throw;
     }
 }