private static async Task RunApplication() { Console.Write("Azure Cosmos DB Table - Enter bulk size: "); int bulkSize = int.Parse(Console.ReadLine()); Console.WriteLine(""); var tableManagment = new TableManagement <MetadataEntity>(); CloudTable table = await tableManagment.CreateOrReferenceTableAsync(TableConstants.TableName); await tableManagment.BulkInsertEntityAsync(table, FakeDataGenerator.GenerateData(bulkSize)); }
public bool DeleteTable(int id) { try { if (id > 0) { TableManagement table = posDatabase.TableManagements.FirstOrDefault(x => x.Id == id); if (table != null) { posDatabase.TableManagements.Remove(table); posDatabase.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool InsertTable(TableManagementModel tableManagementModel) { try { if (tableManagementModel.id > 0) { TableManagement table = posDatabase.TableManagements.Where(x => x.Id == tableManagementModel.id).FirstOrDefault(); if (table == null) { return(false); } else { table.NoOfChair = tableManagementModel.NoOfChair; table.TableNo = tableManagementModel.TableNo; table.RoomId = tableManagementModel.RoomId; posDatabase.SaveChanges(); return(true); } } else { TableManagement table = new TableManagement(); table.NoOfChair = tableManagementModel.NoOfChair; table.TableNo = tableManagementModel.TableNo; table.RoomId = tableManagementModel.RoomId; posDatabase.TableManagements.Add(table); posDatabase.SaveChanges(); return(true); } } catch (Exception) { throw; } }