예제 #1
0
        public JsonResult GetGameContent(string Letter)
        {
            //Console.WriteLine(Request.Url);
            //string decoded = HttpUtility.UrlDecode(Letter);
            GameContentDto dto = new GameContentDto();

            dto.Letter = Letter;
            var specificContent = BLL.Services.ContentServices.LoadAllContents();

            specificContent = specificContent.Where(c => c.Data.IsApproved && c.Data.UnDotedWord.StartsWith(Letter)).ToList();

            dto.Contents          = specificContent;
            dto.ValidLetterName   = null;
            dto.InValidLetterName = null;
            return(Json(dto, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult GetGameLetters(string Letter)
        {
            // This function will need to be examined after "deployment" for url sourcing the correct path for letter images

            Console.WriteLine(Request.Url);

            GameContentDto dto = new GameContentDto();

            dto.Letter = Letter;

            dto.Contents = null;
            string folderPath = AppDomain.CurrentDomain.BaseDirectory;
            string str        = folderPath.Substring(0, folderPath.IndexOf("\\", System.StringComparison.InvariantCultureIgnoreCase) + "\\".Length);

            str        = str + "/";
            str        = str + folderPath.Substring(str.Length - 1).Replace("\\", "/");
            folderPath = str + "Pictures/Alphabet";
            DirectoryInfo di = new DirectoryInfo(folderPath);

            dto.ValidLetterName   = di.GetFiles("*.png").Where(f => f.Name.StartsWith(Letter)).Select(f => f.Name).ToList();
            dto.InValidLetterName = di.GetFiles("*.png").Where(f => !f.Name.StartsWith(Letter)).Select(f => f.Name).ToList();
            return(Json(dto, JsonRequestBehavior.AllowGet));
        }