public static bool AddStock(Stock stock) { using (var dboContext = new MCDBContext()) { dboContext.Stock.Add(stock); return(dboContext.SaveChanges() > 0); } return(false); }
public static bool AddOrderLine(OrderLine orderLine) { using (var dboContext = new MCDBContext()) { dboContext.OrderLine.Add(orderLine); return(dboContext.SaveChanges() > 0); } return(false); }
public static bool AddCustomerOrder(CustomerOrder customerOrder) { using (var dboContext = new MCDBContext()) { dboContext.CustomerOrder.Add(customerOrder); return(dboContext.SaveChanges() > 0); } return(false); }
public void AddProduct(Product product) { Console.WriteLine("Try to add a new entry in database SQLite"); using (var dboContext = new MCDBContext()) { dboContext.Product.Add(product); dboContext.SaveChanges(); } Console.WriteLine("End"); }
public static List <Stock> GetAllStock() { List <Stock> listStocks = new List <Stock>(); using (var dboContext = new MCDBContext()) { var dbList = dboContext.Stock; foreach (Stock Stock in dbList) { listStocks.Add(Stock); } } return(listStocks); }
public static List <OrderLine> GetAllOrderLine() { List <OrderLine> listOrderLines = new List <OrderLine>(); using (var dboContext = new MCDBContext()) { var dbList = dboContext.OrderLine; foreach (OrderLine OrderLine in dbList) { listOrderLines.Add(OrderLine); } } return(listOrderLines); }
public static List <CustomerOrder> GetAllCustomerOrder() { List <CustomerOrder> listCustomerOrders = new List <CustomerOrder>(); using (var dboContext = new MCDBContext()) { var DbList = dboContext.CustomerOrder; foreach (CustomerOrder CustomerOrder in DbList) { listCustomerOrders.Add(CustomerOrder); } } return(listCustomerOrders); }
public void GetProducts() { Console.WriteLine("Get products in database"); using (var dboContext = new MCDBContext()) { var listProduct = dboContext.Product; foreach (Product aProduct in listProduct) { Console.WriteLine($"{aProduct.Id} | {aProduct.Name} | {aProduct.Price}"); } } Console.WriteLine("End"); Console.ReadLine(); }
public OpenSeatsController(MCDBContext context) { _dbContext = context; }