31 lines
979 B
C#
31 lines
979 B
C#
using HegreHotel.Models;
|
|
using Microsoft.Maui.Controls;
|
|
using System.IO;
|
|
using Microsoft.Maui.Storage;
|
|
|
|
namespace HegreHotel.Views.Reservation
|
|
{
|
|
public partial class AjouterReservationPage : ContentPage
|
|
{
|
|
public AjouterReservationPage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private async void OnEnregistrerClicked(object sender, EventArgs e)
|
|
{
|
|
var reservation = new Models.Reservation
|
|
{
|
|
NbPersonnes = int.TryParse(EntryNbInvite.Text, out int nb) ? nb : 0,
|
|
DateDebut = DatePickerDebut.Date,
|
|
DateFin = DatePickerFin.Date,
|
|
DemandeSpecifique = EntryDemandeSpecifique.Text
|
|
};
|
|
|
|
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
|
var db = SingletonConnection.GetInstance(dbPath);
|
|
await db.InsertAsync(reservation);
|
|
await Navigation.PopAsync();
|
|
}
|
|
}
|
|
} |