Add an ID and an empty constructor to the models
The entity framework needs and ID on each model and an empty constructor to be able to save the object to the database. With the obsolete paremeter the constructor won't show up in Visual Studio to be used.
This commit is contained in:
parent
07e0e8b449
commit
38ecf02e34
|
@ -10,10 +10,13 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class City
|
||||
{
|
||||
private int _CityId;
|
||||
private string _Name;
|
||||
private int _ZipCode;
|
||||
private Country _Counry;
|
||||
|
||||
[DataMember]
|
||||
public int CityId { get => _CityId; set => _CityId= value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
[DataMember]
|
||||
|
@ -21,6 +24,9 @@ namespace Server.Models
|
|||
[DataMember]
|
||||
public Country Country { get => _Counry; set => _Counry = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public City() { }
|
||||
|
||||
public City (string name, int zipCode, Country country)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,11 +10,16 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Country
|
||||
{
|
||||
private int _CountryId;
|
||||
private string _Name;
|
||||
|
||||
[DataMember]
|
||||
public int CountryId { get => _CountryId; set => _CountryId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Country() { }
|
||||
public Country (string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,14 +10,19 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Doctor
|
||||
{
|
||||
private int _DoctorId;
|
||||
private Person _Person;
|
||||
private Status _Status;
|
||||
|
||||
[DataMember]
|
||||
public int DoctorId { get => _DoctorId; set => _DoctorId = value; }
|
||||
[DataMember]
|
||||
public Person Person { get => _Person; set => _Person = value; }
|
||||
[DataMember]
|
||||
public Status Status { get => _Status; set => _Status = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Doctor() { }
|
||||
public Doctor (Person person, Status status)
|
||||
{
|
||||
this.Person = person;
|
||||
|
|
|
@ -10,11 +10,14 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Exam
|
||||
{
|
||||
private int _ExamId;
|
||||
private DateTime _Date;
|
||||
private Doctor _Doctor;
|
||||
private Person _Patient;
|
||||
private Result _Result;
|
||||
|
||||
[DataMember]
|
||||
public int ExamId { get => _ExamId; set => _ExamId = value; }
|
||||
[DataMember]
|
||||
public DateTime Date { get => _Date; set => _Date = value; }
|
||||
[DataMember]
|
||||
|
@ -24,6 +27,8 @@ namespace Server.Models
|
|||
[DataMember]
|
||||
public Result Result { get => _Result; set => _Result = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Exam() { }
|
||||
public Exam (Doctor doctor, Person patient, Result result)
|
||||
{
|
||||
this.Date = DateTime.Now;
|
||||
|
|
|
@ -10,11 +10,16 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Gender
|
||||
{
|
||||
private int _GenderId;
|
||||
private string _Name;
|
||||
|
||||
[DataMember]
|
||||
public int GenderId { get => _GenderId; set => _GenderId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Gender() { }
|
||||
public Gender (string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Person
|
||||
{
|
||||
private int _PersonId;
|
||||
private string _FirstName;
|
||||
private string _LastName;
|
||||
private Gender _Gender;
|
||||
|
@ -17,6 +18,8 @@ namespace Server.Models
|
|||
private string _StreetName;
|
||||
private City _City;
|
||||
|
||||
[DataMember]
|
||||
public int PersonId { get => _PersonId; set => _PersonId = value; }
|
||||
[DataMember]
|
||||
public string FirstName { get => _FirstName; set => _FirstName = value; }
|
||||
[DataMember]
|
||||
|
@ -30,6 +33,8 @@ namespace Server.Models
|
|||
[DataMember]
|
||||
public City City { get => _City; set => _City = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Person() { }
|
||||
public Person (string firstName, string lastName, Gender gender, Salutation salutation,
|
||||
string streetName, City city)
|
||||
{
|
||||
|
|
|
@ -10,11 +10,14 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Result
|
||||
{
|
||||
private int _ResultId;
|
||||
private string _Name;
|
||||
private string _Description;
|
||||
private Strain _Strain;
|
||||
private bool _Infected;
|
||||
|
||||
[DataMember]
|
||||
public int ResultId { get => _ResultId; set => _ResultId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
[DataMember]
|
||||
|
@ -24,6 +27,8 @@ namespace Server.Models
|
|||
[DataMember]
|
||||
public bool Infected { get => _Infected; set => _Infected = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Result() { }
|
||||
public Result (string name, string description, Strain strain, bool infected)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,11 +10,16 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Salutation
|
||||
{
|
||||
private int _SalutationId;
|
||||
private string _Name;
|
||||
|
||||
[DataMember]
|
||||
public int SalutationId { get => _SalutationId; set => _SalutationId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Salutation() { }
|
||||
public Salutation (string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,11 +10,16 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Status
|
||||
{
|
||||
private int _StatusId;
|
||||
private string _Name;
|
||||
|
||||
[DataMember]
|
||||
public int StatusId { get => _StatusId; set => _StatusId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Status() { }
|
||||
public Status (string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
|
@ -10,10 +10,16 @@ namespace Server.Models
|
|||
[DataContract]
|
||||
public class Strain
|
||||
{
|
||||
private int _StrainId;
|
||||
private string _Name;
|
||||
|
||||
[DataMember]
|
||||
public int StrainId { get => _StrainId; set => _StrainId = value; }
|
||||
[DataMember]
|
||||
public string Name { get => _Name; set => _Name = value; }
|
||||
|
||||
[Obsolete("Only needed for serialization and materialization", true)]
|
||||
public Strain() { }
|
||||
public Strain (string name)
|
||||
{
|
||||
this.Name = name;
|
||||
|
|
Loading…
Reference in New Issue