Implementation of repositories and return infos
This commit is contained in:
@@ -2,10 +2,27 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using skydiveLogs_api.Data.Interface;
|
||||
using skydiveLogs_api.Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace skydiveLogs_api.Data
|
||||
{
|
||||
public class JumpRepository : IJumpRepository
|
||||
{
|
||||
public IEnumerable<Jump> GetAllJumps()
|
||||
{
|
||||
IEnumerable<Jump> result = new List<Jump>();
|
||||
|
||||
using (StreamReader file = File.OpenText(@"Data/Jump.json"))
|
||||
using (JsonTextReader reader = new JsonTextReader(file))
|
||||
{
|
||||
var jsonResult = (JArray)JToken.ReadFrom(reader);
|
||||
result = jsonResult.ToObject<IEnumerable<Jump>>();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user