Exemple #1
0
        public void start()
        {
            tasks.workDone += EmailService.SendEmail;
            tasks.workDone += PushNotification.SendPushNotification;
            tasks.workDone += TextMessageService.SendText;
            do
            {
                Console.WriteLine("Welcome Hero! What would you like to do?");
                Console.WriteLine("[0] Create a Hero?");
                Console.WriteLine("[1] Get all Heros?");
                Console.WriteLine("[2] Go to work?");
                Console.WriteLine("[3] Go back to the main menu?");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "0":
                    //call create a hero, get hero details
                    SuperHero newSuperHero = GetHeroDetails();
                    //call the business logic and the repo
                    heroService.AddHero(newSuperHero);
                    break;

                case "1":
                    //call get all heros
                    heroService.GetAllHeroes();
                    foreach (var hero in heroService.GetAllHeroes())
                    {
                        Console.WriteLine($"Hero: \n\tHero Alias: {hero.Alias} \n\tHero Real Name: {hero.RealName} \n\tHero Hideout: {hero.HideOut}");
                        foreach (var power in hero.SuperPowers)
                        {
                            Console.WriteLine($"\tSuper Powers:\n\t\tName: {power.Name}\n\t\tDescription: {power.Description}");
                        }
                    }
                    break;

                case "2":
                    //call the event delegate for hero work, call get hero by name
                    tasks.DoWork();
                    tasks.ManageLife();
                    Console.WriteLine("Press <enter>");
                    break;

                case "3":
                    //call the main menu
                    Console.WriteLine("Going back to main");
                    break;

                default:
                    //invalid input message;
                    service.InvalidInputMessage();
                    break;
                }
            } while (!userInput.Equals("3"));
        }
        // GET: Player/Create
        public ActionResult Add()
        {
            IList <Hero>       heroes      = heroService.GetAllHeroes();
            IList <Map>        maps        = mapService.GetAllMaps();
            IList <PlayerType> playerTypes = playerTypeService.GetAllPlayerTypes();
            IList <string>     ranks       = Enum.GetNames(typeof(CompetitiveRank));

            ViewBag.Heroes      = new MultiSelectList(heroes, "Id", "Name");
            ViewBag.Maps        = new MultiSelectList(maps, "Id", "Name");
            ViewBag.PlayerTypes = new MultiSelectList(playerTypes, "Id", "Name");
            ViewBag.Ranks       = ranks;

            return(View());
        }
        public void start()
        {
            tasks.workDone += EmailService.SendEmail;
            tasks.workDone += PushNotification.SendPushNotification;
            tasks.workDone += TextMessageService.SendText;
            do
            {
                Console.WriteLine("Welcome Hero! What would you like to do?");
                Console.WriteLine("[0] Create a Hero?");
                Console.WriteLine("[1] Get all Heros?");
                Console.WriteLine("[2] Go to work?");
                Console.WriteLine("[3] Go back to the main menu?");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "0":
                    //call create a hero, get hero details
                    SuperHero newSuperHero = GetHeroDetails();
                    //call the business logic and the repo
                    heroService.AddHero(newSuperHero);
                    break;

                case "1":
                    //call get all heros
                    heroService.GetAllHeroes();
                    break;

                case "2":
                    //call the event delegate for hero work, call get hero by name
                    tasks.DoWork();
                    tasks.ManageLife();
                    Console.WriteLine("Press <enter>");
                    break;

                case "3":
                    //call the main menu
                    MainMenu main = new MainMenu();
                    main.start();
                    break;

                default:
                    //invalid input message;
                    service.InvalidInputMessage();
                    break;
                }
            } while (!userInput.Equals("3"));
        }
Exemple #4
0
 public IEnumerable <Hero> Get()
 {
     return(service.GetAllHeroes());
 }