test WriteJson

This commit is contained in:
Ivan Hörler 2018-07-17 21:05:13 +02:00
parent 9ec488b15a
commit 61e2161b71
4 changed files with 28 additions and 10 deletions

View File

@ -48,11 +48,21 @@ namespace EHEC_Server
protected void Application_Start(object sender, EventArgs e) protected void Application_Start(object sender, EventArgs e)
{ {
WriteJson();
//add patients //add patients
//using (EHEC_DBEntities ctx = new EHEC_DBEntities()) //using (EHEC_DBEntities ctx = new EHEC_DBEntities())
//{ //{
Random p = new Random();
Random p = new Random();
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
Patient patient = new Patient Patient patient = new Patient

View File

@ -33,5 +33,7 @@ namespace EHEC_Server
return dbAccess; return dbAccess;
} }
} }
} }
} }

View File

@ -10,12 +10,18 @@ namespace EHEC_Server
{ {
public void WriteJson() public void WriteJson()
{ {
var json = JsonConverter.Serialize(GetCompanyObject()); ClusterPatient clusterp = new ClusterPatient();
System.IO.File.WriteAllText(@"C:\Users\Public\Documents\Company.json", json); List<ClusterPatient> clusterPatientList = new List<ClusterPatient>();
clusterPatientList = clusterp.GetClusterPatients();
var json = JsonConverter.Serialize(clusterPatientList);
System.IO.File.WriteAllText(@"C:\Users\novski\Desktop\Company.json", json);
} }
private List<ClusterPatient> GetClusterPatient() private List<ClusterPatient> GetCluster()
{ {
return new List<ClusterPatient>(); return new List<ClusterPatient>();
} }

View File

@ -8,12 +8,12 @@ namespace EHEC_Server
public class ClusterPatient public class ClusterPatient
{ {
public List<Patient> Patients; public List<Patient> Patients { get; set; }
public List<ClusterPatient> ClusterPatients; public List<ClusterPatient> ClusterPatients { get; set; }
public int Id; public int Id { get; set; }
public string Name; public string Name { get; set; }
public List<ClusterPatient> GetPatients() public List<ClusterPatient> GetClusterPatients()
{ {
Patients = Global.GlobalInstance.DbAccess.Patients.ToList(); Patients = Global.GlobalInstance.DbAccess.Patients.ToList();