<commit_before>﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using PagedList;
using PokemonGoGetLog.Models;

namespace PokemonGoGetLog.Controllers
{
    public class HomeController : Controller
    {
        //
        private const string GoogleMapUrl = "https://maps-api-ssl.google.com/maps/api/js?libraries=places&key=";
        //private const string GoogleMapUrl = "http://maps.googleapis.com/maps/api/js?libraries=places&key=";
        private readonly ApplicationDbContext _db = new ApplicationDbContext();

        public ActionResult Index(int? page)
        {
            //https://github.com/TroyGoode/PagedList
            var datas = _db.PokemonGetDatas.OrderBy(x => x.CreateDateTime);
            var pageNumber = page ?? 1;
            return View(datas.ToPagedList(pageNumber, 25));
        }

        // GET: PokemonGetDatas/Details/5
        public async Task<ActionResult> Details(long? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PokemonGetData pokemonGetData = await _db.PokemonGetDatas.FindAsync(id);
            if (pokemonGetData == null)
            {
                return HttpNotFound();
            }
            return View(pokemonGetData);
        }

        // GET: PokemonGetDatas/Create
        public ActionResult Create()
        {
            var pokemonGetData = new PokemonGetData
            {
                Pokemons = PokemonNames.Data.OrderBy(x => x).Select((val, idx) => new PokemonData
                {
                    Id = idx,
                    Name = val
                })
            };

            var appSettings = ConfigurationManager.AppSettings;
            var appKey = appSettings["GoogleMapAPI"];
            ViewBag.GoogleMapUrl = GoogleMapUrl + appKey;
            return View(pokemonGetData);
        }

        // POST: PokemonGetDatas/Create
        // 過多ポスティング攻撃を防止するには、バインド先とする特定のプロパティを有効にしてください。
        // 詳細については、http://go.microsoft.com/fwlink/?LinkId=317598 を参照してください。
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Create([Bind(Include = "PokemonGetDataId,PokemonName,Position,MapX,MapY,Cp,User,ImageUrl,CreateDateTime,UpdateDateTime")] PokemonGetData pokemonGetData)
        {
            pokemonGetData.Pokemons = PokemonNames.Data.OrderBy(x => x).Select((val, idx) => new PokemonData
            {<commit_msg>リダイレクト機能 httpsで現在地をAzureでも取れるように<commit_after>﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using PagedList;
using PokemonGoGetLog.Models;

namespace PokemonGoGetLog.Controllers
{
    public class HomeController : Controller
    {
        //
        private const string GoogleMapUrl = "https://maps-api-ssl.google.com/maps/api/js?libraries=places&key=";
        //private const string GoogleMapUrl = "http://maps.googleapis.com/maps/api/js?libraries=places&key=";
        private readonly ApplicationDbContext _db = new ApplicationDbContext();

        public ActionResult Index(int? page)
        {
            //https://github.com/TroyGoode/PagedList
            var datas = _db.PokemonGetDatas.OrderBy(x => x.CreateDateTime);
            var pageNumber = page ?? 1;
            return View(datas.ToPagedList(pageNumber, 25));
        }

        // GET: PokemonGetDatas/Details/5
        public async Task<ActionResult> Details(long? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PokemonGetData pokemonGetData = await _db.PokemonGetDatas.FindAsync(id);
            if (pokemonGetData == null)
            {
                return HttpNotFound();
            }
            return View(pokemonGetData);
        }

#if DEBUG
#else
        [RequireHttps]
#endif
        // GET: PokemonGetDatas/Create
        public ActionResult Create()
        {
            var pokemonGetData = new PokemonGetData
            {
                Pokemons = PokemonNames.Data.OrderBy(x => x).Select((val, idx) => new PokemonData
                {
                    Id = idx,
                    Name = val
                })
            };

            var appSettings = ConfigurationManager.AppSettings;
            var appKey = appSettings["GoogleMapAPI"];
            ViewBag.GoogleMapUrl = GoogleMapUrl + appKey;
            return View(pokemonGetData);
        }

        // POST: PokemonGetDatas/Create
        // 過多ポスティング攻撃を防止するには、バインド先とする特定のプロパティを有効にしてください。
        // 詳細については、http://go.microsoft.com/fwlink/?LinkId=317598 を参照してください。
        [HttpPost]
        [ValidateAntiForgeryToken]
#if DEBUG
#else
        [RequireHttps]
#endif
        public async Task<ActionResult> Create([Bind(Include = "PokemonGetDataId,PokemonName,Position,MapX,MapY,Cp,User,ImageUrl,CreateDateTime,UpdateDateTime")] PokemonGetData pokemonGetData)
        {
            pokemonGetData.Pokemons = PokemonNames.Data.OrderBy(x => x).Select((val, idx) => new PokemonData
            {
{'fraction_non_alphanumeric': 0.09807224405764552, 'fraction_numerical': 0.0037432154220475387, 'mean_word_length': 2.2, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1450590', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1596, 'n_words': 279}