public bool InsertIntoTable(TransactionItemsModel model) { try { using (var connection = new SQLiteConnection(connectionString)) { connection.Insert(model); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }
private void SaveTransactionItems() { foreach (var item in GlobalVariables.globalProductsOnCart) { mTransactionItem = new TransactionItemsModel { TransactionId = mTransactionsDataAccess.GetLatestTransactionId(), ProductId = item.productId, ProductName = item.productName, ProductSize = item.productSize, ProductPrice = item.productPrice, ProductOrigPrice = item.productOrigPrice, ProductDiscountAmount = item.productDiscountAmount, ProductDiscountPercentage = item.productDiscountPercentage, ProductSubTotalPrice = item.productSubTotalPrice, ProductCountOnCart = item.productCountOnCart }; mTransactionItemsDataAccess.InsertIntoTable(mTransactionItem); } }