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; } }
/*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); }
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(); }
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(); } }
/*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(); }
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(); } }
public Gladiator Read(Lanista lanista) { var gladiator = DB.Gladiators.OrderBy(s => s.LanistaId).Where(s => s.LanistaId == lanista.LanistaId).Single <Gladiator>(); return(gladiator); }