static void InintArr() { baseinventory[0] = new Economicgames("Monopoly", 10, "Game on Board", "Economy", 4, 2); baseinventory[1] = new Logicgames("Chess", 12, "Game on Board", "Logic", "wood", "plastic"); baseinventory[2] = new Bowls("MadBall", 20, "Game on street", "on floor", 10, "wood"); baseinventory[3] = new Tenis("FunyBalls", 25, "Game on street", "on table", "USA", "China"); }
public void Insert(Tenis tenis) { var query = $"INSERT INTO TENIS VALUES ('{tenis.Nome}', {tenis.Tamanho})"; using (_conn = new ConnectionDB()) { _conn.ExecQuery(query); } }
public void Update(Tenis tenis) { var query = $"UPDATE TENIS SET NOME = '{tenis.Nome}', TAMANHO = {tenis.Tamanho} WHERE ID = {tenis.Id}"; using (_conn = new ConnectionDB()) { _conn.ExecQuery(query); } }
public ActionResult Edit(Tenis tenis) { if (ModelState.IsValid) { new TenisDB().Update(tenis); return(RedirectToAction("Index")); } return(View(tenis)); }
public ActionResult Create(Tenis tenis) { if (ModelState.IsValid) { new TenisDB().Insert(tenis); return(RedirectToAction("Index")); } return(View(tenis)); }
private static void Builder() { #region Builder ITenisBuilder tenisBuilder = new Chuteira("Chuteira Adidas"); var tenis = Tenis.Builder(tenisBuilder); GerenciadorSaida.SaidaConsole.EscreverTexto(tenis.ToString()); tenisBuilder = new Sapatenis("Sapatenis WestCoast"); tenis = Tenis.Builder(tenisBuilder); GerenciadorSaida.SaidaConsole.EscreverTexto(tenis.ToString()); #endregion Builder }
private List <Tenis> TransformSQLReaderToList(SqlDataReader returnData) { var list = new List <Tenis>(); while (returnData.Read()) { var item = new Tenis { Id = int.Parse(returnData["Id"].ToString()), Nome = returnData["Nome"].ToString(), Tamanho = float.Parse(returnData["Tamanho"].ToString()) }; list.Add(item); } return(list); }
public Sapatenis(string nome) { _tenis = new Tenis(nome); }
static void AddArr() { BaseInventory[] newbasinventory = new BaseInventory[baseinventory.Length + 1]; for (int i = 0; i < baseinventory.Length; i++) { newbasinventory[i] = baseinventory[i]; } baseinventory = newbasinventory;// while (true) { Console.Clear(); char[] arr = new char[28] { '+', '-', '-', '-', '-', '-', '-', '-', '-', '-', 'A', 'd', 'd', ' ', 'm', 'e', 'n', 'u', '-', '-', '-', '-', '-', '-', '-', '-', '-', '+' }; for (int i = 0; i < 28; i++) { Console.Write(arr[i]); Thread.Sleep(50); Console.SetCursorPosition(i + 1, 0); } Console.WriteLine(); StringBuilder sb = new StringBuilder(); sb.Append("| 1- "); sb.Append((Menuprint)0); sb.AppendLine(" |"); sb.Append("| 2- "); sb.Append((Menuprint)1); sb.AppendLine(" |"); sb.Append("| 3- "); sb.Append((Menuprint)2); sb.AppendLine(" |"); sb.Append("| 4- "); sb.Append((Menuprint)3); sb.AppendLine(" |"); sb.AppendLine("| 5- Exit |"); sb.AppendLine("+--------------------------+"); Console.WriteLine(sb); string choice = Console.ReadLine(); Console.Clear(); switch (choice) { case "1": BaseInventory ecogame = new Economicgames(); ecogame.AddInventry(); baseinventory[baseinventory.Length - 1] = ecogame; break; case "2": BaseInventory logicgame = new Logicgames(); logicgame.AddInventry(); baseinventory[baseinventory.Length - 1] = logicgame; break; case "3": BaseInventory Bowls = new Bowls(); Bowls.AddInventry(); baseinventory[baseinventory.Length - 1] = Bowls; break; case "4": BaseInventory Ping = new Tenis(); Ping.AddInventry(); baseinventory[baseinventory.Length - 1] = Ping; break; case "5": break; } break; } }
public Chuteira(string nome) { _tenis = new Tenis(nome); }