tuto_bindablelayout / BindableLayoutSample / BindableLayoutSample / DAO / AnimalDAO.cs @ 61fbfe25
Historique | Voir | Annoter | Télécharger (1,626 ko)
1 |
using BindableLayoutSample.Model; |
---|---|
2 |
using System; |
3 |
using System.Collections.Generic; |
4 |
using System.Threading.Tasks; |
5 |
|
6 |
namespace BindableLayoutSample.DAO |
7 |
{ |
8 |
// La classe d'accès aux données sur les animaux |
9 |
public class AnimalDAO |
10 |
{ |
11 |
public async Task<List<Animal>> GetAllAnimals() |
12 |
{ |
13 |
// Génération de fausse données |
14 |
List<Animal> ret = new List<Animal>() |
15 |
{ |
16 |
new Animal() |
17 |
{ |
18 |
AnimalID = 27852, |
19 |
DateTraitement = DateTime.Parse("2022-08-05 14:26"), |
20 |
Elevage = "PEIMA" |
21 |
}, |
22 |
new Animal() |
23 |
{ |
24 |
AnimalID = 2421, |
25 |
DateTraitement = DateTime.Parse("2022-08-05 12:33"), |
26 |
Elevage = "PEIMA" |
27 |
}, |
28 |
new Animal() |
29 |
{ |
30 |
AnimalID = 13569, |
31 |
DateTraitement = DateTime.Parse("2022-08-06 08:14"), |
32 |
Elevage = "Lees-Athas" |
33 |
}, |
34 |
new Animal() |
35 |
{ |
36 |
AnimalID = 45555, |
37 |
DateTraitement = DateTime.Parse("2022-08-07 16:21"), |
38 |
Elevage = "Donzacq" |
39 |
}, |
40 |
new Animal() |
41 |
{ |
42 |
AnimalID = 8956, |
43 |
DateTraitement = DateTime.Parse("2022-08-07 18:01"), |
44 |
Elevage = "PEIMA" |
45 |
}, |
46 |
}; |
47 |
|
48 |
// Simulation d'attente d'accès aux données (WS, BDD, ...) |
49 |
await Task.Delay(1000); |
50 |
return ret; |
51 |
} |
52 |
} |
53 |
} |