Beispiel #1
0
        // GET: Monsters
        public ActionResult Index()                              // Show the user their specific monsters
        {
            var userId  = Guid.Parse(User.Identity.GetUserId()); // Sets userId to the GUID of the logged in user
            var service = new MonstersService(userId);           // Sets service to the user's list of monsters they created
            var model   = service.GetMonsters();                 // Gets the user's list of monsters

            return(View(model));                                 // Returns the user's list of monsters
        }
Beispiel #2
0
        private static async Task GetMonsters()
        {
            string          saveLocation = Path.Combine(Directory.GetCurrentDirectory(), "Monsters");
            MonstersService monsters     = new MonstersService(saveLocation);

            try
            {
                IEnumerable <Monster> creatures = await monsters.GetMonsters(false, true);

                SaveJson(creatures, saveLocation, "monsters");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }