Skip to content

Commit

Permalink
<feat: passed content product data to payment page>
Browse files Browse the repository at this point in the history
  • Loading branch information
eben4ya committed Nov 17, 2024
1 parent 127d7dd commit 1fc4b50
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Appview/Views/FoodDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ public partial class FoodDetails : UserControl
{
private int _productId;
private int _stock;
private string _productName;
private string _productDesc;
public FoodDetails(int productId, string Title, decimal Price, int Stock, DateTime Expired, string Description)
{
InitializeComponent();
DataContext = new GetProductFromDB();

_productId = productId;
_productName = Title;
_productDesc = Description;
ContentTitle.Text = Title;
ContentDescription.Text = Description;
ContentPrice.Text = Price.ToString();
ContentStock.Text = Stock.ToString();
ContentExpiry.Text = Expired.ToString();
ContentDescription.Text = Description;
_stock = Stock;
}

Expand Down Expand Up @@ -67,7 +71,7 @@ private void Pesan_Click(object sender, RoutedEventArgs e)
{
//MessageBox.Show("Button clicked successfully!", "Notification", MessageBoxButton.OK, MessageBoxImage.Information);
// Create an instance of FoodDetails page
var paymentPage = new Payment(quantity, price, _productId);
var paymentPage = new Payment(quantity, price, _productId, _productName, _productDesc);

// Get the main window and set its content to the new page
var mainWindow = Application.Current.MainWindow as MainWindow;
Expand Down

0 comments on commit 1fc4b50

Please sign in to comment.