Example #1
0
        public async Task <object> ListPublProductoID(int idProducto)
        {
            Response response = new Response();

            try
            {
                List <ProductoIDServ> list = await _unitOfWork.Murat.ListPublProductoID(idProducto);

                if (list.Count() > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("url_imagenes").Value;
                    foreach (var item in list)
                    {
                        if (item.Archivo_Marca != "")
                        {
                            item.Url_Marca = AuxiliarMethods.GenerarURL(directory, "Marca", item.Archivo_Marca);
                        }
                        if (item.Archivo_Producto != "")
                        {
                            item.Url_Producto = AuxiliarMethods.GenerarURL(directory, "Producto", item.Archivo_Producto);
                        }
                        if (item.Archivo_Talla != "")
                        {
                            item.Url_Talla = AuxiliarMethods.GenerarURL(directory, "Producto", item.Archivo_Talla);
                        }
                        foreach (var imagen in item.Imagen)
                        {
                            if (imagen.Archivo_Produccto_Color != "")
                            {
                                imagen.Url_Color = AuxiliarMethods.GenerarURL(directory, "Producto", imagen.Archivo_Produccto_Color);
                            }
                        }
                        foreach (var color in item.Color)
                        {
                            if (color.SArchivo_Imagen_0 != "")
                            {
                                color.Url_Imagen_0 = AuxiliarMethods.GenerarURL(directory, "Producto", color.SArchivo_Imagen_0);
                            }
                        }
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
Example #2
0
        public async Task <object> GetNroImagen(int tipo, int id1, int id2, int id3)
        {
            Response response = new Response();

            try
            {
                List <ListNroImagen> list = await _unitOfWork.Common.GetNroImagen(tipo, id1, id2, id3);

                if (list.Count > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    foreach (var imagen in list)
                    {
                        foreach (var item in imagen.Archivo_Imagenes)
                        {
                            var categoria = "Producto";
                            if (tipo == 2)
                            {
                                categoria = "Slider";
                            }

                            item.Url_Imagen = AuxiliarMethods.GenerarURL(directory, categoria, item.SArchivo);
                        }
                    }

                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <object> ListarProductos(int cod_Categoria, string sProducto)
        {
            Response response = new Response();

            try
            {
                List <Producto> list = await _unitOfWork.Producto.ListarProductos(cod_Categoria, sProducto);

                if (list.Count > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    foreach (var item in list)
                    {
                        if (item.SArchivo_Talla != "")
                        {
                            item.UrlImagen_Talla = AuxiliarMethods.GenerarURL(directory, "Producto", item.SArchivo_Talla);
                        }

                        if (item.SArchivo_Producto != "")
                        {
                            item.UrlImagen_Producto = AuxiliarMethods.GenerarURL(directory, "Producto", item.SArchivo_Producto);
                        }
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <object> ListSlider(int Tipo, int Id1, int Id2)
        {
            Response response = new Response();

            try
            {
                List <Main> list = await _unitOfWork.Murat.ListSlider(Tipo, Id1, Id2);

                if (list.Count > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("url_imagenes").Value;
                    foreach (var main in list)
                    {
                        foreach (var slider in main.Sliders)
                        {
                            if (slider.SArchivo != "")
                            {
                                slider.UrlImagen = AuxiliarMethods.GenerarURL(directory, "Slider", slider.SArchivo);
                            }
                        }
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }


            return(response);
        }
Example #5
0
        public async Task <object> ListPublProducto(FiltroProducto filtroProducto)
        {
            Response response = new Response();

            try
            {
                var validado = AuxiliarMethods.ValidarFiltros(filtroProducto);

                List <PublicadoProductoServ> list = await _unitOfWork.Murat.ListPublProducto(validado);

                if (list.Count() > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("url_imagenes").Value;
                    foreach (var item in list)
                    {
                        if (item.SArchivo_Producto != "")
                        {
                            item.Url_Producto = AuxiliarMethods.GenerarURL(directory, "Producto", item.SArchivo_Producto);
                        }
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <object> GetImagen(int idProducto)
        {
            Response response = new Response();

            try
            {
                List <ImagenProducto> list = await _unitOfWork.Producto.GetImagen(idProducto);

                if (list.Count > 0)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    foreach (var item in list)
                    {
                        if (item.SArchivo != "")
                        {
                            string url_imagen = AuxiliarMethods.GenerarURL(directory, "Producto", item.SArchivo);
                            item.UrlImagen = url_imagen;
                        }
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                    response.Data    = list;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <object> GetPublicadoID(int cod_Operacion, int idDato)
        {
            Response response = new Response();

            try
            {
                object list = await _unitOfWork.Publicado.GetPublicadoID(cod_Operacion, idDato);

                if (list != null)
                {
                    string directory = _config.GetSection("AppSettings").GetSection("directory").Value;
                    if (cod_Operacion == 1396)
                    {
                        List <PublicadoProducto> lstProd = (List <PublicadoProducto>)list;
                        foreach (var Producto in lstProd)
                        {
                            if (Producto.SArchivo_Producto != "")
                            {
                                Producto.Url_Producto = AuxiliarMethods.GenerarURL(directory, "Producto", Producto.SArchivo_Producto);
                            }
                            if (Producto.Archivo_Marca != "")
                            {
                                Producto.Url_Marca = AuxiliarMethods.GenerarURL(directory, "Marca", Producto.Archivo_Marca);
                            }
                            if (Producto.SArchivo_Talla != "")
                            {
                                Producto.Url_Talla = AuxiliarMethods.GenerarURL(directory, "Producto", Producto.SArchivo_Talla);
                            }
                            foreach (var Color in Producto.Color)
                            {
                                if (Color.SArchivo_Imagen != "")
                                {
                                    Color.Url_Imagen = AuxiliarMethods.GenerarURL(directory, "Producto", Color.SArchivo_Imagen);
                                }
                            }
                            foreach (var Imagen in Producto.Imagen)
                            {
                                if (Imagen.SArchivo_Imagen_0 != "")
                                {
                                    Imagen.Url_Imagen_0 = AuxiliarMethods.GenerarURL(directory, "Producto", Imagen.SArchivo_Imagen_0);
                                }
                            }
                            foreach (var ProdImagen in Producto.Producto_Imagen)
                            {
                                if (ProdImagen.SArchivo_Imagen_0 != "")
                                {
                                    ProdImagen.Url_Imagen_0 = AuxiliarMethods.GenerarURL(directory, "Producto", ProdImagen.SArchivo_Imagen_0);
                                }
                            }
                        }
                        response.Data = lstProd;
                    }
                    else if (cod_Operacion == 1397)
                    {
                        List <PublicadoMarca> lstMarca = (List <PublicadoMarca>)list;
                        foreach (var Marca in lstMarca)
                        {
                            if (Marca.SArchivo != "")
                            {
                                Marca.Url_Marca = AuxiliarMethods.GenerarURL(directory, "Marca", Marca.SArchivo);
                            }
                        }
                        response.Data = lstMarca;
                    }
                    else if (cod_Operacion == 1398)
                    {
                        List <PublicadoSlider> lstSlider = (List <PublicadoSlider>)list;
                        foreach (var Slider in lstSlider)
                        {
                            if (Slider.SArchivo != "")
                            {
                                Slider.Url_Slider = AuxiliarMethods.GenerarURL(directory, "Slider", Slider.SArchivo);
                            }
                        }
                        response.Data = lstSlider;
                    }
                    else
                    {
                        response.Data = list;
                    }
                    response.Status  = Constant.Status;
                    response.Message = Constant.Ok;
                }
                else
                {
                    response.Status  = Constant.Error400;
                    response.Message = Constant.Consult;
                }
            }
            catch (Exception e)
            {
                response.Status  = Constant.Error500;
                response.Message = e.Message;
            }
            return(response);
        }