Пример #1
0
        public void Update(Lanista lanista, Gladiator gladiator, string gladiatorName,
                           bool alive, bool win, bool killed)

        {
            Console.WriteLine("\n*Update Gladiator*");

            gladiator.LanistaId     = lanista.LanistaId;
            gladiator.GladiatorName = gladiatorName;

            DB.Gladiators.Update(gladiator);
            DB.SaveChanges();

            gladiator.Alive = alive;
            if (win == true)
            {
                gladiator.Wins += 1;
            }
            else
            {
                gladiator.Loss += 1;
            }
            if (killed == true)
            {
                gladiator.Kills += 1;
            }
        }
Пример #2
0
        /*public List<Gladiator> ShopReadAll(Shop shop)
         * {
         *  Console.WriteLine("\n*Read ShopGladiator*");
         *  var SortGladiatorShop = DB.Gladiators.Where(s => s.ShopId == shop.ShopId).OrderBy(s => s.GladiatorId).ToList<Gladiator>();
         *  return SortGladiatorShop;
         * }*/
        public List <Gladiator> LanistaReadAll(Lanista lanista)
        {
            Console.WriteLine("\n*Read LanistaGladiator*");
            var SortGladiatorLanista = DB.Gladiators.Where(s => s.LanistaId == lanista.LanistaId)
                                       .OrderBy(s => s.GladiatorId).ToList <Gladiator>();

            return(SortGladiatorLanista);
        }
Пример #3
0
        public void Create(string lanistaName, int userId)
        {
            Console.WriteLine("\n*Create Lanista*");
            var name    = lanistaName;
            var Lanista = new Lanista {
                LanistaName = name, UserId = userId, Money = 100
            };

            DB.Lanistas.Add(Lanista);
            DB.SaveChanges();
        }
Пример #4
0
        public void Destroy(Lanista lanista)
        {
            Console.WriteLine("\n*Destroy Lanista*");
            DB.Lanistas.Remove(lanista);

            Console.WriteLine("Confirm Delete [y]: ");
            var key = Console.ReadKey();

            if (key.Key == ConsoleKey.Y)
            {
                DB.SaveChanges();
            }
        }
Пример #5
0
        /*public void ShopCreate(Shop shop)
         * {
         *  Console.WriteLine("\n*ShopCreate Gladiator*");
         *  var owner = shop.ShopId;
         *  var Gladiator = new Gladiator { ShopId = owner, Alive = true, Health = 20, Stamina = 25, Strength = 15, Defense = 0, Speed = 0, Morale = 50, Kills = 0, Loss = 0, Wins = 0 };
         *  DB.Gladiators.Add(Gladiator);
         *  DB.SaveChanges();
         * }*/
        public void LanistaCreate(Lanista lanista)
        {
            Console.WriteLine("\n*LanistaCreate Gladiator*");
            var owner     = lanista.LanistaId;
            var Gladiator = new Gladiator {
                LanistaId = owner,
                Alive     = true,
                Health    = 20, Stamina = 25, Strength = 15, Defense = 0, Speed = 0, Morale = 50,
                Kills     = 0, Loss = 0, Wins = 0
            };

            DB.Gladiators.Add(Gladiator);
            DB.SaveChanges();
        }
Пример #6
0
        public void Update(Lanista lanista, string lanistaName, int money)
        {
            Console.WriteLine("\n*Update Lanista*");
            lanista.LanistaName = lanistaName;
            lanista.Money       = money;

            Console.WriteLine("Confirm [y]: ");
            var key = Console.ReadKey();

            if (key.Key == ConsoleKey.Y)
            {
                DB.Lanistas.Update(lanista);
                DB.SaveChanges();
            }
        }
Пример #7
0
        public Gladiator Read(Lanista lanista)
        {
            var gladiator = DB.Gladiators.OrderBy(s => s.LanistaId).Where(s => s.LanistaId == lanista.LanistaId).Single <Gladiator>();

            return(gladiator);
        }