public ITable CreateTable(string type, int tableNumber, int capacity) { //Type tableType = Assembly.GetEntryAssembly().GetTypes().FirstOrDefault(t => t.Name == type); //ITable table = (ITable)Activator.CreateInstance(tableType, tableNumber, capacity); ITable table; switch (type) { case nameof(InsideTable): table = new InsideTable(tableNumber, capacity); break; case nameof(OutsideTable): table = new OutsideTable(tableNumber, capacity); break; default: table = null; break; } return(table); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type) { case "Inside": table = new InsideTable(tableNumber, capacity); break; case "Outside": table = new OutsideTable(tableNumber, capacity); break; default: break; } string result = string.Empty; if (table != null) { this.tables.Add(table); result = string.Format(OutputMessages.TableMade, table.TableNumber); } return(result); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table; if (type == "Inside") { table = new InsideTable(tableNumber, capacity); } else { table = new OutsideTable(tableNumber, capacity); } tables.Add(table); return($"Added table number {table.TableNumber} in the restaurant"); }
public Table CreateTable(string type, int tableNumber, int capacity) { Table table = null; if (type == "Inside") { table = new InsideTable(tableNumber, capacity); } else if (type == "Outside") { table = new OutsideTable(tableNumber, capacity); } return(table); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } else if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } tables.Add(table); return($"Added table number {tableNumber} in the bakery"); }
public string AddTable (string type, int tableNumber, int capacity) { if (type == "OutsideTable") { var table = new OutsideTable(tableNumber, capacity, 3.50m); tables.Add(table); } else { var table = new InsideTable(tableNumber, capacity, 2.50m); tables.Add(table); } return($"Added table number {tableNumber} in the bakery"); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; if (type == nameof(OutsideTable)) { table = new OutsideTable(tableNumber, capacity); } if (type == nameof(InsideTable)) { table = new InsideTable(tableNumber, capacity); } this.tables.Add(table); return($"Added table number {tableNumber} in the bakery"); }
public string AddTable(string type, int tableNumber, int capacity) { Table table; if (type.ToLower() == "insidetable") { table = new InsideTable(tableNumber, capacity); tables.Add(table); } else if (type.ToLower() == "outsidetable") { table = new OutsideTable(tableNumber, capacity); tables.Add(table); } return($"Added table number {tableNumber} in the bakery"); }
public ITable Create(string type, int tableNumber, int capacity) { switch (type) { case "Inside": ITable insideTable = new InsideTable(tableNumber, capacity); return(insideTable); case "Outside": ITable outsideTable = new OutsideTable(tableNumber, capacity); return(outsideTable); default: return(null); } }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } else if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } tables.Add(table); return(string.Format(OutputMessages.TableAdded, tableNumber)); }
private ITable CreateTable(TableType tableType, int tableNumber, int capacity) { ITable table = null; switch (tableType) { case TableType.InsideTable: table = new InsideTable(tableNumber, capacity); break; case TableType.OutsideTable: table = new OutsideTable(tableNumber, capacity); break; } return(table); }
private ITable CreateTable(string tableType, int tableNumber, int capacity) { ITable table = null; if (tableType == TableType.InsideTable.ToString()) { table = new InsideTable(tableNumber, capacity); } if (tableType == TableType.OutsideTable.ToString()) { table = new OutsideTable(tableNumber, capacity); } return(table); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type) { case "InsideTable": table = new InsideTable(tableNumber, capacity); break; case "OutsideTable": table = new OutsideTable(tableNumber, capacity); break; default: break; } this.tables.Add(table); return(string.Format(OutputMessages.TableAdded, tableNumber)); }
public ITable CreateTable(string type, int tableNumber, int capacity) { ITable tableToReturn = null; switch (type.ToLower()) { case "inside": tableToReturn = new InsideTable(tableNumber, capacity); break; case "outside": tableToReturn = new OutsideTable(tableNumber, capacity); break; } return(tableToReturn); }
private static ITable CheckIFTableExistsAndCreateIt(string type, int tableNumber, int capacity) { Enum.TryParse(type, out TableType tableType); ITable currentTable = null; switch (tableType) { case TableType.InsideTable: currentTable = new InsideTable(tableNumber, capacity); break; case TableType.OutsideTable: currentTable = new OutsideTable(tableNumber, capacity); break; } return(currentTable); }
public string AddTable(string type, int tableNumber, int capacity) { string output = string.Empty; if (type == "Inside") { var table = new InsideTable(tableNumber, capacity); tables.Add(table); output = $"Added table number {table.TableNumber} in the restaurant"; } else if (type == "Outside") { var table = new OutsideTable(tableNumber, capacity); tables.Add(table); output = $"Added table number {table.TableNumber} in the restaurant"; } return(output); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type) { case "InsideTable": table = new InsideTable(tableNumber, capacity); break; case "OutsideTable": table = new OutsideTable(tableNumber, capacity); break; } tableList.Add(table); //TODO: idk return($"Added table number {table.TableNumber} in the bakery"); //TODO: if?? }
public ITable CreateTable(string type, int tableNumber, int capacity) { ITable table = null; if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } else if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } else { throw new ArgumentException("InvalidType"); } return(table); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type) { case "Inside": table = new InsideTable(tableNumber, capacity); break; case "Outside": table = new OutsideTable(tableNumber, capacity); break; } this.tables.Add(table); return($"Added table number {table.TableNumber} in the restaurant"); }
public ITable CreateTables(string type, int tableNumber, int capacity) { ITable table = null; if (type == "Inside") { table = new InsideTable(tableNumber, capacity); } else if (type == "Outside") { table = new OutsideTable(tableNumber, capacity); } else { throw new InvalidOperationException("Invalid table type!"); } return(table); }
//Tова е фактори без рефлекшън. public ITable CtreatTable(string type, int tableNumber, int capacity) { ITable table; switch (type) { case "Inside": table = new InsideTable(tableNumber, capacity); break; case "Outside": table = new OutsideTable(tableNumber, capacity); break; default: table = null; break; } return(table); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type.ToLower()) { case "inside": table = new InsideTable(tableNumber, capacity); break; case "outside": table = new OutsideTable(tableNumber, capacity); break; default: throw new ArgumentException($"Invalid table type {type}!"); } this.tables.Add(table); return($"Added table number {table.TableNumber} in the restaurant"); }
public string AddTable(string type, int tableNumber, int capacity) { if (type != "InsideTable" && type != "OutsideTable") { throw new ArgumentException(); } Table table = null; if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } this.tables.Add(table); return(String.Format(OutputMessages.TableAdded, tableNumber)); }
public string AddTable(string type, int tableNumber, int capacity) { Table table = null; if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } else if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } if (table != null) { tables.Add(table); return($"Added table number {tableNumber} in the bakery"); } return(null); // To be checked later! }
public string AddTable(string type, int tableNumber, int capacity) { if (type == "InsideTable" || type == "OutsideTable") { ITable table = null; switch (type) { case "InsideTable": table = new InsideTable(tableNumber, capacity); break; case "OutsideTable": table = new OutsideTable(tableNumber, capacity); break; } tables.Add(table); return(String.Format(OutputMessages.TableAdded, tableNumber)); } return(null); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; switch (type) { case nameof(InsideTable): table = new InsideTable(tableNumber, capacity); break; case nameof(OutsideTable): table = new OutsideTable(tableNumber, capacity); break; } if (table == null) { return("NotGooooodTableee"); } this.tables.Add(table); return($"Added table number {tableNumber} in the bakery"); }
public string AddTable(string type, int tableNumber, int capacity) { ITable table = null; if (type.ToLower() == "insidetable") { table = new InsideTable(tableNumber, capacity); } else if (type.ToLower() == "outsidetable") { table = new OutsideTable(tableNumber, capacity); } if (table != null) { this.tables.Add(table); return(String.Format(OutputMessages.TableAdded, table.TableNumber)); } else { throw new ArgumentNullException(); } }
public string AddTable(string type, int tableNumber, int capacity) { Assembly assembly = Assembly.GetExecutingAssembly(); var currentType = assembly.GetTypes().FirstOrDefault(x => x.Name == type); object[] args = { tableNumber, capacity }; var table = (ITable)Activator.CreateInstance(currentType, args); if (type == "InsideTable") { table = new InsideTable(tableNumber, capacity); } else if (type == "OutsideTable") { table = new OutsideTable(tableNumber, capacity); } this.tables.Add(table); return($"Added table number {tableNumber} in the bakery"); }