private void AddProductToDetailList() { if (orderOperationsObj.GetLastDetailOrderIndex() < 1) { productDetailListId = 0; } else { productDetailListId = orderOperationsObj.GetLastDetailOrderIndex(); } //productDetailListId = orderOperationsObj.GetAllDetailProductList().Last().Id; foreach (var item in ProductSizesTable) { Console.WriteLine(item); } //int tempId = OrdersList.Last().Id + 1; //Console.WriteLine($"Last Index tempId = {tempId}"); bool isAdded = orderOperationsObj.AddProductToDg(++productDetailListId, SelectedProduct, SelectedProductQuantity, SelectedProductPrice, SelectedProductTotalValue, ProductSizesTable, SelectedProduct.Image); Console.WriteLine(orderDetailListObj.Id); LoadCurrentOrderDetalList(); try { if (isAdded) { Message = "Product has been added to the list"; Console.WriteLine("Dodano "); } else { Message = "Product has not been added to the list"; Console.WriteLine("Nie Dodano "); } } catch (Exception ex) { Message = ex.Message; Console.WriteLine("Bląd"); } }