Statistiques
| Branche: | Révision:

root / GES_PAC / ViewModel / PlaceViewModel.cs @ 6f451cc1

Historique | Voir | Annoter | Télécharger (832 octets)

1
using GES_PAC.Model;
2
using Microsoft.EntityFrameworkCore;
3
using System.Collections.ObjectModel;
4

    
5
namespace GES_PAC.ViewModel
6
{
7
    public class PlaceViewModel
8
    {
9
        #region Attributs
10
        private static PlaceViewModel _instance;
11
        #endregion
12

    
13
        #region Propriétés
14
        public ObservableCollection<Lieu> Places { get; set; } = new();
15
        public static PlaceViewModel Instance => _instance ??= new PlaceViewModel();
16
        #endregion
17
        
18
        #region Constructeur
19
        private PlaceViewModel() {
20
            _ = InitAsync();
21
        }
22
        #endregion
23
        #region Méthodes
24
        public async Task InitAsync()
25
        {
26
            var lieux = await App.Db.Lieu.ToListAsync();
27
            foreach (var l in lieux)
28
                Places.Add(l);
29
        }
30
        #endregion
31
    }
32
}