Flesh out domain and start student commands

This commit is contained in:
2019-04-24 17:50:37 +00:00
parent a51306af55
commit a30e9a5b1c
18 changed files with 648 additions and 197 deletions

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BrightGlimmer.Domain
{
[Table("Addresses")]
public class Address : Entity
{
public string StreetAddress1 { get; set; }
public string StreetAddress2 { get; set; }
public string City { get; set; }
public string StateCode { get; set; }
public string County { get; set; }
public string ZipCode { get; set; }
public decimal Latitude { get; set; }
public decimal Longitude { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BrightGlimmer.Domain
{
[Table("AssignedCourses")]
public class AssignedCourse : Entity
{
public decimal Grade { get; set; }
public bool IsActive { get; set; }
public string Term { get; set; }
public Student Student { get; set; }
public Course Course { get; set; }
}
}

View File

@@ -4,4 +4,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.Annotations">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\ref\netcoreapp2.2\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BrightGlimmer.Domain
{
[Table("Courses")]
public class Course : Entity
{
public string Name { get; set; }

View File

@@ -7,5 +7,16 @@ namespace BrightGlimmer.Domain
public class Entity
{
public Guid Id { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public Entity()
{
Id = Guid.NewGuid();
CreatedDate = DateTime.UtcNow;
ModifiedDate = DateTime.UtcNow;
}
}
}

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BrightGlimmer.Domain
{
[Table("Phones")]
public class Phone : Entity
{
public PhoneType Type { get; set; }

View File

@@ -1,15 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace BrightGlimmer.Domain
{
[Table("Students")]
public class Student : Entity
{
[NotMapped]
private readonly int MAX_STUDENT_NUMBER = 100000000;
public int StudentNumber { get; 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 Address Address { get; set; }
public string ProfilePictureUrl { get; set; }
public List<AssignedCourse> AssignedCourses { get; set; }
public Student() : base()
{
StudentNumber = new Random().Next(MAX_STUDENT_NUMBER); /* TODO: Optimize student number creation */
}
}
}