public void AddAnimeToBase(string userToken, Dictionary <string, object> anime)
        {
            if (!IsAdmin(userToken))
            {
                return;
            }
            //Анти дудос, в продакшене раскоменть

            /*var cookie = Context.Request.Cookies["WL"];
             * if(cookie != null)
             * {
             *  return;
             * }*/
            AnimeLight anim = new AnimeLight();

            anim.AnimeFromJs(anime);
            if (anim.Id == -1)
            {
                anim.SendToBase();
            }
            else
            {
                anim.UpdateBase();
            }
            anim.ClearCache();

            /*var nCookie = new HttpCookie("WL", "VioletEvergraden");
             * nCookie.Expires = DateTime.Now.AddMinutes(1);
             * Context.Response.Cookies.Add(nCookie);*/
        }
        public void LoadTops(int count)
        {
            string command = "SELECT TOP {0} a.Id, a.Name, a.Image, a.Popularity, COUNT(w.Id) as waifCount " +
                             "FROM Anime a LEFT JOIN Waifu w ON (w.AnimeId LIKE a.Id) GROUP BY " +
                             "a.Id, a.Name, a.Image, a.Popularity, a.Description ORDER BY {1} DESC";

            using (var cmd = new SqlCommand(String.Format(command, count, "a.Popularity"), _connection))
            {
                var rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    AnimeLight temp = new AnimeLight(rd);
                    TopViewed.Add(temp);
                }
                rd.Close();
            }

            using (var cmd = new SqlCommand(String.Format(command, count, "waifCount"), _connection))
            {
                var rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    AnimeLight temp = new AnimeLight(rd);
                    temp.Popularity = Convert.ToInt32(rd["waifCount"]);
                    TopPers.Add(temp);
                }
                rd.Close();
            }
        }
        public bool LoadAnime(int id)
        {
            if (_connection == null)
            {
                return(false);
            }
            var res = false;

            using (var cmd = new SqlCommand("SELECT * FROM Anime WHERE Id=@Id", _connection))
            {
                cmd.Parameters.AddWithValue("Id", id);
                var rd = cmd.ExecuteReader();
                if (rd.Read())
                {
                    PageAnim = new AnimeLight(rd);
                    res      = true;
                }
                rd.Close();
            }
            return(res);
        }