diff --git a/MauiAppStock/App.xaml.cs b/MauiAppStock/App.xaml.cs index f709f05..7bb788a 100644 --- a/MauiAppStock/App.xaml.cs +++ b/MauiAppStock/App.xaml.cs @@ -9,7 +9,7 @@ public partial class App : Application { InitializeComponent(); // On démarre sur MainPage dans une NavigationPage pour permettre la navigation - MainPage = new AppShell(); + MainPage = new NavigationPage(new MainPage()); InitializeDatabase(); } diff --git a/MauiAppStock/AppShell.xaml b/MauiAppStock/AppShell.xaml index 16d2bb4..260140d 100644 --- a/MauiAppStock/AppShell.xaml +++ b/MauiAppStock/AppShell.xaml @@ -6,12 +6,5 @@ xmlns:views="clr-namespace:MauiAppStock.Views" Shell.FlyoutBehavior="Disabled" Title="MauiAppStock"> - - - - - - - - + diff --git a/MauiAppStock/AppShell.xaml.cs b/MauiAppStock/AppShell.xaml.cs index e0da968..3729ae9 100644 --- a/MauiAppStock/AppShell.xaml.cs +++ b/MauiAppStock/AppShell.xaml.cs @@ -7,10 +7,7 @@ public partial class AppShell : Shell public AppShell() { InitializeComponent(); - Routing.RegisterRoute(nameof(MainPage), typeof(MainPage)); - Routing.RegisterRoute(nameof(AppareilsPage), typeof(AppareilsPage)); - Routing.RegisterRoute(nameof(PiecesPage), typeof(PiecesPage)); - Routing.RegisterRoute(nameof(SelectAppareilForAssociationPage), typeof(SelectAppareilForAssociationPage)); + } protected override void OnNavigating(ShellNavigatingEventArgs args) { diff --git a/MauiAppStock/Data/Database.cs b/MauiAppStock/Data/Database.cs index dbfae7f..4330285 100644 --- a/MauiAppStock/Data/Database.cs +++ b/MauiAppStock/Data/Database.cs @@ -95,6 +95,35 @@ namespace MauiAppStock.Data return db.InsertAsync(appareilPiece); } + // CRUD pour MouvementStock + public static Task AddMouvementStockAsync(MouvementStock mouvement) + { + return db.InsertAsync(mouvement); + } + + public static Task> GetMouvementsStockAsync() + { + return db.Table().OrderByDescending(m => m.DateMouvement).ToListAsync(); + } + + public static async Task> GetMouvementsStockForPieceAsync(int pieceId) + { + return await db.Table() + .Where(m => m.PieceId == pieceId) + .OrderByDescending(m => m.DateMouvement) + .ToListAsync(); + } + + public static Task UpdateMouvementStockAsync(MouvementStock mouvement) + { + return db.UpdateAsync(mouvement); + } + + public static Task DeleteMouvementStockAsync(MouvementStock mouvement) + { + return db.DeleteAsync(mouvement); + } + // Met à jour une association existante public static Task UpdateAppareilPieceAsync(AppareilPiece appareilPiece) { diff --git a/MauiAppStock/Views/MainPage.xaml b/MauiAppStock/Views/MainPage.xaml index 2f892d9..ae39711 100644 --- a/MauiAppStock/Views/MainPage.xaml +++ b/MauiAppStock/Views/MainPage.xaml @@ -8,6 +8,7 @@