Fleshed out entity classes and created command to create student

This commit is contained in:
2019-04-24 23:57:55 +00:00
parent a30e9a5b1c
commit acba25cc0b
13 changed files with 129 additions and 27 deletions

View File

@@ -11,19 +11,44 @@ namespace BrightGlimmer.Domain
[NotMapped]
private readonly int MAX_STUDENT_NUMBER = 100000000;
public int StudentNumber { get; set; }
public int StudentNumber { get; private set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public List<Phone> Phones { get; set; }
public string Email { get; private set; }
public Address Address { get; set; }
public string ProfilePictureUrl { get; set; }
public List<AssignedCourse> AssignedCourses { get; set; }
public Student() : base()
private readonly List<Phone> phones = new List<Phone>();
public IReadOnlyList<Phone> Phones => phones;
private readonly List<AssignedCourse> assignedCourses = new List<AssignedCourse>();
public IReadOnlyList<AssignedCourse> AssignedCourses => assignedCourses;
private Student() { }
public Student(string firstName,
string lastName,
string email,
List<Phone> phones,
Address address) : base()
{
StudentNumber = new Random().Next(MAX_STUDENT_NUMBER); /* TODO: Optimize student number creation */
FirstName = firstName;
LastName = lastName;
Email = email;
Address = address;
this.phones = phones;
}
public void AddPhone(Phone phone)
{
phones.Add(phone);
}
public void AddAssignedCourse(AssignedCourse assignedCourse)
{
assignedCourses.Add(assignedCourse);
}
}
}