25 lines
767 B
C#
25 lines
767 B
C#
using System.IO;
|
|
using Microsoft.Maui.Storage;
|
|
using System.Threading.Tasks;
|
|
using HegreHotel.Models;
|
|
|
|
namespace HegreHotel
|
|
{
|
|
public class Database
|
|
{
|
|
public static async Task CreateDatabaseAsync()
|
|
{
|
|
// Construction du chemin de la BDD dans le dossier AppData
|
|
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
|
|
|
// Récupération de l'instance unique du Singleton
|
|
var db = SingletonConnection.GetInstance(dbPath);
|
|
|
|
// Création des tables
|
|
await db.CreateTableAsync<Client>();
|
|
await db.CreateTableAsync<Reservation>();
|
|
await db.CreateTableAsync<Chambre>();
|
|
await db.CreateTableAsync<Status>();
|
|
}
|
|
}
|
|
} |