29 lines
791 B
C#
29 lines
791 B
C#
using skydiveLogs_api.Data.Interface;
|
|
using skydiveLogs_api.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.IO;
|
|
|
|
namespace skydiveLogs_api.Data
|
|
{
|
|
public class AircraftRepository : IAircraftRepository
|
|
{
|
|
public IEnumerable<Aircraft> GetAllAircrafts()
|
|
{
|
|
IEnumerable<Aircraft> result = new List<Aircraft>();
|
|
|
|
using (StreamReader file = File.OpenText(@"Data/Aircraft.json"))
|
|
using (JsonTextReader reader = new JsonTextReader(file))
|
|
{
|
|
var jsonResult = (JArray)JToken.ReadFrom(reader);
|
|
result = jsonResult.ToObject<IEnumerable<Aircraft>>();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|