private async void OnValidSubmit() { try { if (StockValidation.IdRack == 0) { Notification.Notify(NotificationSeverity.Warning, "Attention", "Le Rack choisi n'est pas bon."); return; } if (string.IsNullOrEmpty(StockValidation.ReferenceProduit)) { Notification.Notify(NotificationSeverity.Warning, "Attention", "La référence de produit choisie n'est pas bonne."); return; } Stock stock = StockValidation.ToStock(); await ContextSql.AddNewStock(stock); Notification.Notify(NotificationSeverity.Success, "Sauvegarde OK", "Sauvegarde OK"); // remise à zéro StockValidation = new EntreStockValidation(); StateHasChange.Invoke(); // Récupération de l'enregistrement StockView newStock = await ContextSql.GetStocks(stock.RackId, stock.ProduitId); Log.Information($"STOCK ENTREE - Ajout de {newStock.Quantite} de {newStock.ReferenceProduit} sur {newStock.GisementPos}"); AllStock.Add(newStock); await StockGrid.Reload(); } catch (Exception ex) { Log.Error(ex, "StockViewModel - OnValidSubmit"); Notification.Notify(NotificationSeverity.Success, "Error", "Erreur sur la sauvegarde"); } }