38 lines
850 B
C#
38 lines
850 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using HegreHotel.Models;
|
|
|
|
namespace HegreHotel.Views;
|
|
|
|
public partial class ClientsPage : ContentPage
|
|
{
|
|
public ClientsPage()
|
|
{
|
|
InitializeComponent();
|
|
ChargerClients();
|
|
}
|
|
|
|
private async void ChargerClients()
|
|
{
|
|
var clients = await ClientService.GetClientsAsync();
|
|
ClientsList.ItemsSource = clients;
|
|
}
|
|
|
|
private async void OnAjouterClientClicked(object sender, EventArgs e)
|
|
{
|
|
var nouveauClient = new Client
|
|
{
|
|
Nom = "Dupont",
|
|
Prenom = "Jean",
|
|
Email = "jean.dupont@example.com",
|
|
Telephone = "0123456789"
|
|
};
|
|
|
|
await ClientService.AjouterClient(nouveauClient);
|
|
ChargerClients();
|
|
}
|
|
}
|