Esempio n. 1
0
        // GET: { 3-letter set name }
        // There may be a ?draw=xxxxxx querystring param, but we ignore that here;
        //  it's used by the client and asynchronously calls back to LoadDraw()
        public IActionResult Index(string setCode)
        {
            var set = _setService.GetSet(setCode);

            var lowerCaseSetCode = setCode.ToLower();

            if (SetFileExists(lowerCaseSetCode))
            {
                var setMain = _setService.GetMainFileForSet(lowerCaseSetCode);
                set.StartProductName = setMain.StartProductName;
                set.CardFiles        = setMain.CardFiles;
                set.PackFiles        = setMain.PackFiles;
                set.Updates          = setMain.Updates;

                return(View("SetView", set));
            }

            // Certain words are reserved (con, aux, etc) so I suffix them with _
            else if (SetFileExists(lowerCaseSetCode + "_"))
            {
                return(View(lowerCaseSetCode + "_", set));
            }
            else if (set != null)
            {
                ViewBag.SetCode = setCode;
                ViewBag.SetName = set.Name;
                return(View("ErrorSetNotYetCreated"));
            }

            ViewBag.SetCode = setCode;
            return(View("ErrorNoSuchSet"));
        }