Implementation of repositories and return infos

This commit is contained in:
Sébastien André
2019-09-26 15:31:17 +02:00
parent 4d6787af20
commit ed3f7c42c5
34 changed files with 1382 additions and 8 deletions

View File

@@ -1,11 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using skydiveLogs_api.Data.Interface;
using skydiveLogs_api.Model;
namespace skydiveLogs_api.Data
{
public class DropZoneRepository : IDropZoneRepository
{
public IEnumerable<DropZone> GetAllDzs()
{
IEnumerable<DropZone> result = new List<DropZone>();
using (StreamReader file = File.OpenText(@"Data/DropZone.json"))
using (JsonTextReader reader = new JsonTextReader(file))
{
var jsonResult = (JArray)JToken.ReadFrom(reader);
result = jsonResult.ToObject<IEnumerable<DropZone>>();
}
return result;
}
}
}