Beispiel #1
0
        public IEnumerable <dynamic> Lista(int clienteId, List <int> estados)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var response = db.t_Orden
                               .Where(x => estados.Contains(x.IdOrdenEstado.Value) && x.IdCliente == clienteId)
                               .Select(x => new
                {
                    id        = x.Id,
                    cliente   = x.Nombre,
                    telefono  = x.Telefono,
                    idEstado  = x.t_OrdenEstado.Id,
                    estado    = x.t_OrdenEstado.Estado,
                    fechaCreo = x.FechaCreo,
                    asignadoA = x.t_Usuario.Nombre + " " + x.t_Usuario.Apellido
                })
                               .OrderBy(x => x.fechaCreo)
                               .ToList();

                db.Database.Connection.Close();

                return(response);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public IEnumerable <dynamic> Lista(int clienteId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var response = db.t_Usuario.Where(x => x.ClienteId == clienteId)
                               .Select(x => new
                {
                    id        = x.Id,
                    itemName  = x.Nombre + " " + x.Apellido,
                    correo    = x.Correo,
                    usuario   = x.Usuario,
                    fechaCreo = x.CreadoFecha
                })
                               .ToList();

                db.Database.Connection.Close();

                return(response);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #3
0
        public IEnumerable <dynamic> GetEstados()
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var response = db.t_OrdenEstado
                               .Select(x => new
                {
                    id       = x.Id,
                    itemName = x.Estado,
                    estado   = "Estados"
                })
                               .OrderBy(x => x.id)
                               .ToList();

                db.Database.Connection.Close();

                return(response);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public dynamic GetUsuarioById(int usuarioId, int clienteId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var response = db.t_Usuario.Where(x => x.Id == usuarioId && x.ClienteId == clienteId)
                               .Select(x => new
                {
                    id         = x.Id,
                    nombre     = x.Nombre,
                    apellido   = x.Apellido,
                    correo     = x.Correo,
                    usuario    = x.Usuario,
                    contrasena = x.Contrasena,
                    rolId      = x.RolId
                })
                               .FirstOrDefault();

                db.Database.Connection.Close();

                return(response);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #5
0
        public dynamic GetProductoById(int productoId, int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();
            //.Where(x => x.Borrado == false)

            var producto = db.t_Producto
                           .Where(x => x.Borrado == false && x.t_Usuario.ClienteId == clienteId && x.Id == productoId) // Listar productos del cliente Id
                           .Select(x => new
            {
                productoId  = x.Id,
                categoriaId = x.IdCategoria,
                producto    = x.Producto,
                descripcion = x.Descripcion,
                precio      = x.Precio,
                costo       = x.Costo,
                activo      = x.Activo,
                imagen      = x.Imagen
            })
                           .FirstOrDefault();

            db.Database.Connection.Close();

            return(producto);
        }
        public BaseResponse Borrar(int tiendaId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var _tienda = db.t_Tienda.Where(x => x.Id == tiendaId).FirstOrDefault();
                if (_tienda == null)
                {
                    return(new BaseResponse {
                        Mensaje = "La tienda no existe", Resultado = false
                    });
                }

                _tienda.Borrado = true;

                db.SaveChanges();

                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = "Tienda Borrada", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al borrar la tienda: " + ex.Message, Resultado = false
                });
            }
        }
Beispiel #7
0
        public IEnumerable <dynamic> BuscarProductos(int clienteId, string texto)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();
            //.Where(x => x.Borrado == false)

            var lista = db.t_Producto
                        .Where(x => x.Borrado == false && x.Activo == true && x.t_Categoria.IdCliente == clienteId &&
                               (x.Producto.ToLower().Contains(texto) || x.t_Categoria.Categoria.ToLower().Contains(texto))) // Listar productos del cliente Id
                        .Select(x => new
            {
                productoId  = x.Id,
                categoriaId = x.IdCategoria,
                categoria   = x.t_Categoria.Categoria,
                producto    = x.Producto,
                descripcion = x.Descripcion,
                imagen      = x.Imagen,

                precio   = x.Precio,
                costo    = x.Costo,
                cantidad = 0,
                total    = 0,
                agregado = false
            })
                        .OrderBy(x => x.productoId)
                        .ToList();

            db.Database.Connection.Close();

            return(lista);
        }
        public BaseResponse EliminarUsuario(int usuariId, int clienteId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var usuario = db.t_Usuario.Where(x => x.Id == usuariId && x.ClienteId == clienteId).FirstOrDefault();
                if (usuario == null)
                {
                    return(new BaseResponse {
                        Mensaje = "El usuario no existe", Resultado = false
                    });
                }

                db.t_Usuario.Remove(usuario);

                db.SaveChanges();

                db.Database.Connection.Close();

                return(new BaseResponse {
                    Mensaje = "Usuario Eliminado", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al eliminar el usuario", Resultado = false
                });
            }
        }
        public BaseResponse GetTienda(int tiendaId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var _tienda = db.t_Tienda.Where(x => x.Id == tiendaId).FirstOrDefault();
                if (_tienda == null)
                {
                    return(new BaseResponse {
                        Mensaje = "La tienda no existe", Resultado = false
                    });
                }

                var tienda = new Tienda();
                tienda.Nombre            = _tienda.Nombre;
                tienda.Logo              = _tienda.Logo;
                tienda.Banner            = _tienda.Banner;
                tienda.IdCliente         = Convert.ToInt32(_tienda.IdCliente);
                tienda.IdCategoriaTienda = Convert.ToInt32(_tienda.IdCategoriaTienda);

                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = "Tienda Encontrada", Resultado = true, Objeto = tienda
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al buscar la tienda: " + ex.Message, Resultado = false
                });
            }
        }
Beispiel #10
0
        public IEnumerable <dynamic> GetProductos(int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();
            //.Where(x => x.Borrado == false)

            var lista = db.t_Producto
                        .Where(x => x.Borrado == false && x.Activo == true && x.t_Categoria.IdCliente == clienteId) // Listar productos del cliente Id
                        .Select(x => new
            {
                productoId        = x.Id,
                categoriaId       = x.IdCategoria,
                categoriaTiendaId = x.t_Tienda.t_CategoriaTienda.Id,
                //categoriaTienda = x.t_Tienda.t_CategoriaTienda.CategoriaTienda,
                producto    = x.Producto,
                descripcion = x.Descripcion,
                imagen      = x.Imagen,

                precio   = x.Precio,
                cantidad = 1,
                total    = 0,
                agregado = false
            })
                        .OrderBy(x => x.productoId)
                        .ToList();

            db.Database.Connection.Close();

            return(lista);
        }
        public BaseResponse Actualizar(Tienda tienda)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var _tienda = db.t_Tienda.Where(x => x.Id == tienda.Id).FirstOrDefault();
                if (_tienda == null)
                {
                    return(new BaseResponse {
                        Mensaje = "La tienda no existe", Resultado = false
                    });
                }

                _tienda.Nombre            = tienda.Nombre;
                _tienda.Logo              = tienda.Logo;
                _tienda.Banner            = tienda.Banner;
                _tienda.IdCategoriaTienda = tienda.IdCategoriaTienda;

                db.SaveChanges();

                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = "Tienda Actualizada", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al actualizar la tienda: " + ex.Message, Resultado = false
                });
            }
        }
Beispiel #12
0
        public IEnumerable <dynamic> GetTiendas(int categoriaId, int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            //string token = Convert.ToString(userToken);

            var response = db.t_Tienda
                           .Where(x =>
                                  x.IdCategoriaTienda == categoriaId &&
                                  x.IdCliente == clienteId &&
                                  x.Borrado == false
                                  )
                           .Select(x => new
            {
                tiendaId      = x.Id,
                tienda        = x.Nombre,
                logo          = x.Logo,
                banner        = x.Banner,
                observaciones = x.Observaciones,
                paginaWeb     = x.Paginaweb
            }).ToList();

            db.Database.Connection.Close();

            return(response);
        }
Beispiel #13
0
        public BaseResponse Eliminar(int categoriaId, int clienteId, int usuarioId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var categoria = db.t_CategoriaTienda.Where(x => x.Id == categoriaId && x.IdCliente == clienteId).FirstOrDefault();
                if (categoria == null)
                {
                    return(new BaseResponse {
                        Mensaje = "La categoria no se encontro en la base de datos", Resultado = false
                    });
                }

                categoria.Borrado        = true;
                categoria.FechaBorro     = DateTime.Now;
                categoria.IdUsuarioBorro = usuarioId;

                db.SaveChanges();

                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = "Categoria Eliminada", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al eliminar la categoria: " + ex.Message, Resultado = false
                });
            }
        }
        public dynamic GetCategoriaById(int categoriaId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var categoria = db.t_Categoria
                            .Where(x => x.Id == categoriaId)
                            .Select(x => new
            {
                id        = x.Id,
                tiendaId  = x.IdTienda,
                categoria = x.Categoria,
                imagen    = x.Imagen,
                productos = x.t_Producto
                            .Where(p => p.IdCategoria == categoriaId && p.Borrado == false)
                            .Select(p => new
                {
                    productoId     = p.Id,
                    productoNombre = p.Producto,
                    descripcion    = p.Descripcion,
                    precio         = p.Precio,
                    activo         = p.Activo,
                    fechaCreo      = p.FechaCreo
                }).ToList()
            })
                            .FirstOrDefault();

            db.Database.Connection.Close();

            return(categoria);
        }
        public BaseResponse Crear(Tienda tienda)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var _tienda = new t_Tienda();
                _tienda.Nombre            = tienda.Nombre;
                _tienda.IdCliente         = tienda.IdCliente;
                _tienda.IdCategoriaTienda = tienda.IdCategoriaTienda;
                _tienda.Banner            = tienda.Banner;
                _tienda.Logo    = tienda.Logo;
                _tienda.Borrado = false;
                db.t_Tienda.Add(_tienda);

                db.SaveChanges();

                db.Database.Connection.Close();

                return(new BaseResponse {
                    Mensaje = "Tienda Creada", Resultado = true, Objeto = _tienda.Id
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al crear la tienda: " + ex.Message, Resultado = false
                });
            }
        }
        public dynamic Login(string username, string password, int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var usuario = db.t_Usuario.Where(x => x.Usuario == username && x.Contrasena == password && x.ClienteId == clienteId)
                          .Select(x => new { id = x.Id, username = x.Usuario, role = x.RolId, name = x.Nombre + " " + x.Apellido, correo = x.Correo, cliente = x.t_Cliente })
                          .FirstOrDefault();

            if (usuario != null)
            {
                // Remove Existing Sessions
                var sessions = db.t_Sesion.Where(x => x.UserId == usuario.id).ToList();
                if (sessions.Count > 0)
                {
                    db.t_Sesion.RemoveRange(sessions);
                }

                t_Sesion sesion = new t_Sesion();
                sesion.Id          = Guid.NewGuid();
                sesion.FechaCreo   = DateTime.Now;
                sesion.FechaExpira = DateTime.Now.AddMinutes(30);
                sesion.UserId      = usuario.id;
                db.t_Sesion.Add(sesion);
                db.SaveChanges();

                db.Database.Connection.Close();
                var cliente = usuario.cliente.Nombre;
                return(new { token = sesion.Id, usuario.username, usuario.role, usuario.name, usuario.correo, fechaExpira = sesion.FechaExpira, cliente });
            }

            db.Database.Connection.Close();
            return(new { Mensaje = "Usuario o contraseña incorrecta" });
        }
Beispiel #17
0
        public BaseResponse ActualizarImagenUrl(int categoriaId, int clienteId, string url)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                // existente
                var categoria = db.t_CategoriaTienda.Where(x => x.Id == categoriaId && x.IdCliente == clienteId).FirstOrDefault();
                if (categoria == null)
                {
                    return(new BaseResponse {
                        Mensaje = "La categoria no se encontro en la base de datos", Resultado = false
                    });
                }
                categoria.Imagen = url;

                db.SaveChanges();
                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = "Imagen Actualizada", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al actualizar la imagen", Resultado = false
                });
            }
        }
        public IEnumerable <dynamic> Categorias(int clienteId, int tiendaId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            //string token = Convert.ToString(userToken);

            var response = db.SP_Categoria_List(clienteId, tiendaId).ToList();

            db.Database.Connection.Close();

            return(response);
        }
Beispiel #19
0
        public Sesion GetSesion(Guid sesionId)
        {
            Sesion sesion = null;

            var db = new pedidoclick();

            db.Database.Connection.Open();

            sesion = db.t_Sesion.Where(x => x.Id == sesionId).Select(x => new Sesion {
                Id = x.Id, FechaExpira = x.FechaExpira
            }).FirstOrDefault();
            db.Database.Connection.Close();

            return(sesion);
        }
Beispiel #20
0
        public dynamic GetOrdenById(int ordenId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var response = db.t_Orden
                               .Where(x => x.Id == ordenId)
                               .Select(x => new
                {
                    id         = x.Id,
                    cliente    = x.Nombre,
                    telefono   = x.Telefono,
                    correo     = x.CorreoElectronico,
                    identidad  = x.Identidad,
                    calle      = x.Calle,
                    avenida    = x.Avenida,
                    colonia    = x.Colonia,
                    ciudad     = x.Ciudad,
                    comentario = x.Comentario,
                    idEstado   = x.t_OrdenEstado.Id,
                    estado     = x.t_OrdenEstado.Estado,
                    fechaCreo  = x.FechaCreo,
                    detalle    = x.t_OrdenDetalle.Where(d => d.IdOrden == x.Id && (d.Borrado == false || d.Borrado == null))
                                 .Select(d => new
                    {
                        categoria  = d.t_Producto.t_Categoria.Categoria,
                        idProducto = d.IdProducto,
                        producto   = d.t_Producto.Producto,
                        precio     = d.Precio,
                        cantidad   = d.Cantidad,
                        total      = d.Precio * d.Cantidad
                    }),
                    total = x.t_OrdenDetalle.Where(d => d.IdOrden == x.Id).Select(d => new { total = d.Precio * d.Cantidad }).Sum(d => d.total)
                })
                               .OrderBy(x => x.fechaCreo)
                               .FirstOrDefault();

                db.Database.Connection.Close();

                return(response);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #21
0
        public int?GetUserIdFromSession(Guid token)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var sesion = db.t_Sesion.FirstOrDefault(x => x.Id == token);

            if (sesion != null)
            {
                db.Database.Connection.Close();
                return(sesion.UserId);
            }

            db.Database.Connection.Close();

            return(null);
        }
        public BaseResponse CrearUsuario(CrearUsuarioRequest r, int clienteId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var usuarioExiste = db.t_Usuario.Where(x => x.Usuario == r.Usuario && x.ClienteId == clienteId).FirstOrDefault();
                if (usuarioExiste != null)
                {
                    return(new BaseResponse {
                        Mensaje = "El usuario ya existe", Resultado = false
                    });
                }

                var u = new t_Usuario();
                u.Nombre      = r.Nombre;
                u.Apellido    = r.Apellido;
                u.ClienteId   = clienteId;
                u.RolId       = r.RolId;
                u.Usuario     = r.Usuario;
                u.Contrasena  = r.Contrasena;
                u.Correo      = r.Correo;
                u.CreadoFecha = DateTime.Now;
                u.Borrado     = false;

                db.t_Usuario.Add(u);

                db.SaveChanges();

                db.Database.Connection.Close();

                return(new BaseResponse {
                    Mensaje = "Usuario Creado", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al crear el usuario", Resultado = false
                });
            }
        }
Beispiel #23
0
        public bool Update(Guid sessionId, DateTime?fechaExpira)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var sesion = db.t_Sesion.FirstOrDefault(x => x.Id == sessionId);

            if (sesion != null)
            {
                sesion.FechaExpira = fechaExpira;
                db.Database.Connection.Close();
                return(true);
            }

            db.Database.Connection.Close();

            return(false);
        }
Beispiel #24
0
        public BaseResponse GetProductosByTienda(int clienteId, int tiendaId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var productos = db.t_Producto
                                .Where(x =>
                                       x.Borrado == false &&
                                       x.Activo == true &&
                                       x.t_Categoria.IdCliente == clienteId &&
                                       x.IdTienda == tiendaId)
                                .Select(x => new
                {
                    productoId  = x.Id,
                    categoriaId = x.IdCategoria,
                    producto    = x.Producto,
                    descripcion = x.Descripcion,
                    imagen      = x.Imagen,

                    precio   = x.Precio,
                    cantidad = 1,
                    total    = 0,
                    agregado = false
                })
                                .OrderBy(x => x.productoId)
                                .ToList();

                db.Database.Connection.Close();

                return(new BaseResponse {
                    Mensaje = "Productos encontrados", Resultado = true, Objeto = productos
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al recuperar los productos", Resultado = false
                });
            }
        }
        public IEnumerable <dynamic> GetCategoriasByTienda(int clienteId, int tiendaId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            //string token = Convert.ToString(userToken);

            var response = db.t_Categoria.Where(x => x.IdCliente == clienteId && x.Borrado == false && x.IdTienda == tiendaId)
                           .Select(x => new
            {
                categoriaId     = x.Id,
                categoria       = x.Categoria,
                numeroProductos = x.t_Producto.Where(c => c.Borrado == false && c.Activo == true).Count()
            }).ToList();

            db.Database.Connection.Close();

            return(response);
        }
Beispiel #26
0
        public IEnumerable <dynamic> GetMensajes()
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var mensajes = db.t_Mensajes.Select(x => new
            {
                nombre   = x.Nombre,
                correo   = x.Correo,
                telefono = x.Telefono,
                empresa  = x.Empresa,
                mensaje  = x.Mensaje,
                fecha    = x.FechaCreacion
            })
                           .OrderBy(x => x.fecha);

            db.Database.Connection.Close();
            return(mensajes);
        }
Beispiel #27
0
        public BaseResponse AsignarOrden(int ordenId, int usuarioId, int estadoId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var orden = db.t_Orden.Where(x => x.Id == ordenId).FirstOrDefault();
                if (orden == null)
                {
                    return(new BaseResponse {
                        Mensaje = "No se pudo encontrar la orden", Resultado = false
                    });
                }

                if (usuarioId > 0)
                {
                    orden.IdAsignado = usuarioId;
                }
                else
                {
                    orden.IdAsignado = null;
                }

                orden.IdOrdenEstado = estadoId;

                db.SaveChanges();

                db.Database.Connection.Close();

                return(new BaseResponse {
                    Mensaje = "Orden Asignada", Resultado = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al asignar la orden", Resultado = false
                });
            }
        }
Beispiel #28
0
        public dynamic GetCategoriaById(int categoriaId, int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            var response = db.t_CategoriaTienda.Where(x => x.IdCliente == clienteId && x.Borrado == false)
                           .Select(x => new
            {
                categoriaId = x.Id,
                categoria   = x.CategoriaTienda,
                fechaCreo   = x.FechaCreo,
                activo      = x.Activo,
                imagen      = x.Imagen
            }).FirstOrDefault();

            db.Database.Connection.Close();

            //return categoria;
            return(response);
        }
Beispiel #29
0
        public IEnumerable <dynamic> GetCategorias(int clienteId)
        {
            var db = new pedidoclick();

            db.Database.Connection.Open();

            //string token = Convert.ToString(userToken);

            var response = db.t_CategoriaTienda.Where(x => x.IdCliente == clienteId && x.Borrado == false)
                           .Select(x => new CategoriaTienda
            {
                categoriaId     = x.Id,
                categoria       = x.CategoriaTienda,
                activo          = x.Activo,
                imagen          = x.Imagen,
                fechaCreo       = x.FechaCreo,
                numeroProductos = 0
            }).ToList();

            foreach (var c in response)
            {
                int categoriaId      = c.categoriaId;
                int _numeroProductos = 0;

                var tiendas = db.t_Tienda.Where(x => x.IdCategoriaTienda == c.categoriaId && x.Borrado == false).ToList();

                foreach (var t in tiendas)
                {
                    var productos = db.t_Producto.Where(x => x.IdTienda == t.Id).ToList();
                    _numeroProductos += productos.Count;
                }

                var _categoriaActualizar = response.FirstOrDefault(x => x.categoriaId == categoriaId);
                _categoriaActualizar.numeroProductos = _numeroProductos;
            }

            db.Database.Connection.Close();

            return(response);
        }
        public BaseResponse GetTiendas(int clienteId)
        {
            try
            {
                var db = new pedidoclick();
                db.Database.Connection.Open();

                var _tiendas = db.t_Tienda.Where(x => x.IdCliente == clienteId).ToList();

                var tiendas = new List <Tienda>();

                foreach (var t in _tiendas)
                {
                    var tienda = new Tienda();
                    tienda.Id                = t.Id;
                    tienda.Nombre            = t.Nombre;
                    tienda.Logo              = t.Logo;
                    tienda.Banner            = t.Banner;
                    tienda.IdCliente         = Convert.ToInt32(t.IdCliente);
                    tienda.IdCategoriaTienda = Convert.ToInt32(t.IdCategoriaTienda);
                    if (tienda.IdCategoriaTienda > 0)
                    {
                        tienda.CategoriaTienda = db.t_CategoriaTienda.Where(x => x.Id == tienda.IdCategoriaTienda && x.IdCliente == clienteId).FirstOrDefault().CategoriaTienda;
                    }
                    tiendas.Add(tienda);
                }

                db.Database.Connection.Close();
                return(new BaseResponse {
                    Mensaje = $"Tienda Encontradas {tiendas.Count}", Resultado = true, Objeto = tiendas
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    Mensaje = "Sucedio un error al buscar las tiendas: " + ex.Message, Resultado = false
                });
            }
        }