public TableBLL(Table table) { TableID = table.TableID; RestaurantID = table.RestaurantID; Capacity = table.Capacity; CellNumber = table.CellNumber; Description = table.Description; ReservationRealizationBLL = new List<ReservationRealizationBLL>(); if(table.ReservationRealizations != null) { foreach (ReservationRealization r in table.ReservationRealizations) { ReservationRealizationBLL.Add(new ReservationRealizationBLL(r)); } } }
public RestaurantManager ConfigureTables(int restaurantID, List<int> tableIndexes, int width, int height, int userID) { List<Table> tables = new List<Table>(); foreach(int tableIndex in tableIndexes) { Table table = new Table() { RestaurantID = restaurantID, CellNumber = tableIndex }; tables.Add(table); } _context.Tables.AddRange(tables); Restaurant restaurant = _context.Restaurants.Find(restaurantID); restaurant.TablesMatrixWidth = width; restaurant.TablesMatrixHeight = height; restaurant.Configured = true; _context.SaveChanges(); return _context.RestaurantManagers.Include(r => r.Restaurant).Where(r => r.UserID == userID).First(); }