Beispiel #1
0
        public IActionResult AddArea([FromBody] Area newArea)
        {
            Area area = newArea;

            context.Area.Add(area);
            context.SaveChanges();
            return(new OkObjectResult(area));
        }
        public IActionResult AddTeam([FromBody] Teams newTeam)
        {
            Teams team = new Teams();

            team = newTeam;

            context.Teams.Add(team);
            context.SaveChanges();
            return(new OkObjectResult(team));
        }
        private void StatsChecker(Players player)
        {
            if (player.PlayerLevel < 5)
            {
                player.PlayerTitle = "Private";
            }
            else if (player.PlayerLevel >= 50)
            {
                player.PlayerTitle = "Sergeant Major of the Army";
            }
            else if (player.PlayerLevel >= 45)
            {
                player.PlayerTitle = "Command Sergeant Major";
            }
            else if (player.PlayerLevel >= 40)
            {
                player.PlayerTitle = "Sergeant Major";
            }
            else if (player.PlayerLevel >= 35)
            {
                player.PlayerTitle = "First Sergeant";
            }
            else if (player.PlayerLevel >= 30)
            {
                player.PlayerTitle = "Master Sergeant";
            }
            else if (player.PlayerLevel >= 25)
            {
                player.PlayerTitle = "Sergeant First Class";
            }
            else if (player.PlayerLevel >= 20)
            {
                player.PlayerTitle = "Staff Sergeant";
            }
            else if (player.PlayerLevel >= 15)
            {
                player.PlayerTitle = "Sergeant";
            }
            else if (player.PlayerLevel >= 10)
            {
                player.PlayerTitle = "Corporal";
            }
            else if (player.PlayerLevel >= 5)
            {
                player.PlayerTitle = "Private First Class";
            }


            if (player.PlayerExp >= 1000)
            {
                player.PlayerLevel++;
                player.PlayerExp -= 1000;
                context.Players.Update(player);
                context.SaveChanges();
            }

            if (player.PlayerTroops > 25)
            {
                player.PlayerReserveTroops += player.PlayerTroops - 25;
                player.PlayerTroops         = 25;
            }
        }