public List <ComentariosAspNet_Users> ObtenerListadoPorIdImagen(int idImagen)
        {
            List <ComentariosAspNet_Users> lista = new List <ComentariosAspNet_Users> ();

            try
            {
                string sql = "SELECT AspNet_Users.*, Comentarios.* FROM Comentarios INNER JOIN AspNet_Users ON Comentarios.UserId = aspnet_Users.UserId WHERE Comentarios.IdImagen = @idImagen";

                SqlCommand comando = new SqlCommand();

                comando.Connection = BaseDatos.conexion;

                comando.CommandText = sql;

                comando.Parameters.AddWithValue("@idImagen", idImagen);

                BaseDatos.conexion.Open();

                SqlDataReader reader = comando.ExecuteReader();

                ComentariosAspNet_Users comentariosAspnet_users;

                while (reader.Read())
                {
                    comentariosAspnet_users = new ComentariosAspNet_Users();

                    comentariosAspnet_users.IdComentario = Convert.ToInt32(reader["IdComentario"]);

                    comentariosAspnet_users.UserId = new Guid(reader["UserId"].ToString());

                    comentariosAspnet_users.IdImagen = Convert.ToInt32(reader["IdImagen"]);

                    comentariosAspnet_users.Comentario = reader["Comentario"].ToString();

                    comentariosAspnet_users.FechaPublicacion = Convert.ToDateTime(reader["FechaPublicacion"]);

                    comentariosAspnet_users.MeGusta = Convert.ToInt32(reader["MeGusta"]);

                    comentariosAspnet_users.ApplicationId = new Guid(reader["ApplicationId"].ToString());

                    comentariosAspnet_users.UserName = reader["UserName"].ToString();

                    comentariosAspnet_users.LoweredUserName = reader["LoweredUserName"].ToString();

                    comentariosAspnet_users.MobileAlias = reader["MobileAlias"].ToString();

                    comentariosAspnet_users.IsAnonymous = Convert.ToInt32(reader["IsAnonymous"]);

                    comentariosAspnet_users.LastActivityDate = Convert.ToDateTime(reader["LastActivityDate"]);

                    lista.Add(comentariosAspnet_users);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                BaseDatos.conexion.Close();
            }

            return(lista);
        }
        public List<ComentariosAspNet_Users> ObtenerListadoPorIdImagen( int idImagen )
        {
            List < ComentariosAspNet_Users > lista = new List < ComentariosAspNet_Users > ();

            try
            {

                string sql = "SELECT AspNet_Users.*, Comentarios.* FROM Comentarios INNER JOIN AspNet_Users ON Comentarios.UserId = aspnet_Users.UserId WHERE Comentarios.IdImagen = @idImagen";

                SqlCommand comando = new SqlCommand();

                comando.Connection = BaseDatos.conexion;

                comando.CommandText = sql;

                comando.Parameters.AddWithValue ( "@idImagen", idImagen );

                BaseDatos.conexion.Open();

                SqlDataReader reader = comando.ExecuteReader();

                ComentariosAspNet_Users comentariosAspnet_users;

                while ( reader.Read() )
                {

                    comentariosAspnet_users = new ComentariosAspNet_Users();

                    comentariosAspnet_users.IdComentario = Convert.ToInt32 ( reader["IdComentario"] );

                    comentariosAspnet_users.UserId = new Guid ( reader["UserId"].ToString() );

                    comentariosAspnet_users.IdImagen = Convert.ToInt32 ( reader["IdImagen"] );

                    comentariosAspnet_users.Comentario = reader["Comentario"].ToString();

                    comentariosAspnet_users.FechaPublicacion = Convert.ToDateTime ( reader["FechaPublicacion"] );

                    comentariosAspnet_users.MeGusta = Convert.ToInt32 ( reader["MeGusta"] );

                    comentariosAspnet_users.ApplicationId = new Guid ( reader["ApplicationId"].ToString() );

                    comentariosAspnet_users.UserName = reader["UserName"].ToString();

                    comentariosAspnet_users.LoweredUserName = reader["LoweredUserName"].ToString();

                    comentariosAspnet_users.MobileAlias = reader["MobileAlias"].ToString();

                    comentariosAspnet_users.IsAnonymous = Convert.ToInt32 ( reader["IsAnonymous"] );

                    comentariosAspnet_users.LastActivityDate = Convert.ToDateTime ( reader["LastActivityDate"] );

                    lista.Add ( comentariosAspnet_users );

                }

            }
            catch ( Exception )
            {

                throw;

            }
            finally
            {

                BaseDatos.conexion.Close();

            }

            return lista;
        }