Browse Source

Added db initialization + extended public classes

master
Daniel Gyulai 4 years ago
parent
commit
30b0c9225c
  1. 3
      CoviDok/Api/Objects/PublicAssistant.cs
  2. 5
      CoviDok/Api/Objects/PublicDoctor.cs
  3. 1
      CoviDok/Api/Objects/PublicParent.cs
  4. 18
      CoviDok/Data/Model/Assistant.cs
  5. 16
      CoviDok/Data/Model/Doctor.cs
  6. 15
      CoviDok/Data/Model/Parent.cs
  7. 2
      CoviDok/Data/Model/RoleUser.cs
  8. 6
      CoviDok/Data/Model/User.cs
  9. 4
      CoviDok/Startup.cs

3
CoviDok/Api/Objects/PublicAssistant.cs

@ -8,10 +8,11 @@ namespace CoviDok.Api.Objects
public class PublicAssistant
{
public string SessionID { get; set; }
public int DoctorId { get; set; }
public int? DoctorId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public int ID { get; set; }
public string PictureID { get; set; }
}
}

5
CoviDok/Api/Objects/PublicDoctor.cs

@ -11,11 +11,8 @@ namespace CoviDok.Api.Objects
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string PictureID { get; set; }
public string Email { get; set; }
public ICollection<int> Children { get; set; } = new List<int>();
public ICollection<int> Assistants { get; set; } = new List<int>();
}
}

1
CoviDok/Api/Objects/PublicParent.cs

@ -13,5 +13,6 @@ namespace CoviDok.Api.Objects
public string LastName { get; set; }
public string Email { get; set; }
public ICollection<PublicChild> Children { get; set; } = new List<PublicChild>();
public string PictureID { get; internal set; }
}
}

18
CoviDok/Data/Model/Assistant.cs

@ -8,15 +8,27 @@ namespace CoviDok.Data.Model
{
public class Assistant : RoleUser
{
public int DoctorId { get; set; }
public int? DoctorId { get; set; }
public void UpdateSelf(PublicAssistant assistant)
{
FirstName = assistant.FirstName;
LastName = assistant.LastName;
Email = assistant.Email;
PictureId = assistant.PictureID;
DoctorId = assistant.DoctorId;
}
public PublicAssistant ToPublic()
{
throw new NotImplementedException();
return new PublicAssistant
{
FirstName = FirstName,
LastName = LastName,
Email = Email,
PictureID = PictureId,
ID = Id,
DoctorId = DoctorId
};
}
}
}

16
CoviDok/Data/Model/Doctor.cs

@ -12,12 +12,22 @@ namespace CoviDok.Data.Model
public ICollection<Assistant> Assistants { get; set; } = new List<Assistant>();
public void UpdateSelf(PublicDoctor doctor) {
public void UpdateSelf(PublicDoctor doctor) {
FirstName = doctor.FirstName;
LastName = doctor.LastName;
Email = doctor.Email;
PictureId = doctor.PictureID;
}
public PublicDoctor ToPublic()
{
throw new NotImplementedException();
return new PublicDoctor
{
FirstName = FirstName,
LastName = LastName,
Email = Email,
PictureID = PictureId,
ID = Id
};
}
}

15
CoviDok/Data/Model/Parent.cs

@ -10,13 +10,22 @@ namespace CoviDok.Data.Model
{
public ICollection<Child> Children { get; set; } = new List<Child>();
public void UpdateSelf(PublicParent doctor)
public void UpdateSelf(PublicParent parent)
{
FirstName = parent.FirstName;
LastName = parent.LastName;
Email = parent.Email;
PictureId = parent.PictureID;
}
public PublicParent ToPublic()
{
throw new NotImplementedException();
return new PublicParent {
FirstName = FirstName,
LastName = LastName,
Email = Email,
PictureID = PictureId,
ID = Id
};
}
}
}

2
CoviDok/Data/Model/RoleUser.cs

@ -13,7 +13,7 @@ namespace CoviDok.Data.Model
public Role Role { get; set; }
public string Email { get; set; }
public string Password { get; set; }
private static byte[] GetHash(string inputString)
{

6
CoviDok/Data/Model/User.cs

@ -15,9 +15,5 @@ namespace CoviDok.Data.Model
public DateTime RegistrationDate { get; set; }
public string PictureId { get; set; }
}
}
}

4
CoviDok/Startup.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoviDok.Data.MySQL;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -32,6 +33,9 @@ namespace CoviDok
app.UseMvc();
MySqlContext ctx = new MySqlContext();
ctx.Database.EnsureCreated();
//app.UseEndpoints(endpoints =>
//{
// endpoints.MapGet("/", async context =>

Loading…
Cancel
Save