Skip to content

Commit

Permalink
fixes; thought I had pushed these fixes 🫠
Browse files Browse the repository at this point in the history
  • Loading branch information
erikshafer committed May 23, 2024
1 parent 960ad6c commit ca56545
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions StudentEnrollment01.InMemory/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using StudentEnrollment01.InMemory.Events;

var id = Guid.Parse("a662d446-4920-415e-8c2a-0dd4a6c58908");
var now = DateTime.Now;
var now = DateTime.Now.ToUniversalTime();

var studentCreated = new StudentCreated
{
CreatedAtUtc = now.ToUniversalTime(),
CreatedAtUtc = now,
StudentId = id,
FullName = "Erik Shafer",
Email = "[email protected]",
Expand All @@ -19,6 +19,9 @@
var student = inMemoryDb.GetStudent(id);

Console.WriteLine(
"StudentId: {0} | FullName: {1} | Email: {2} | DateOfBirth: {3} | CreatedAtUtc: {4}",
"StudentId: {0}\nFullName: {1}\nEmail: {2}\nDateOfBirth: {3}\nCreatedAtUtc: {4}",
student!.Id, student.FullName, student.Email, student.DateOfBirth, student.CreatedAtUtc);
Console.WriteLine("Enrolled courses:");
foreach (var enrolledCourse in student.EnrolledCourses)
Console.WriteLine($"\t- {enrolledCourse}");
Console.WriteLine();
3 changes: 2 additions & 1 deletion StudentEnrollment01.InMemory/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ private void Apply(StudentCreated @event)
Id = @event.StudentId;
FullName = @event.FullName;
Email = @event.Email;
DateOfBirth = @event.DateOfBirth;
CreatedAtUtc = @event.CreatedAtUtc;
}

private void Apply(StudentUpdated @event)
{
Id = @event.StudentId; // Updating the identity, huh? Interesting... 👀
FullName = @event.FullName;
Email = @event.Email;
}
Expand Down
2 changes: 2 additions & 0 deletions StudentEnrollment02.Esdb/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ private void Apply(StudentCreated @event)
Id = @event.StudentId;
FullName = @event.FullName;
Email = @event.Email;
DateOfBirth = @event.DateOfBirth;
CreatedAtUtc = @event.CreatedAtUtc;
}

private void Apply(StudentUpdated @event)
{
FullName = @event.FullName;
Email = @event.Email;
}

Expand Down
1 change: 1 addition & 0 deletions StudentEnrollment03.Esdb/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private void Apply(StudentCreated @event)
Id = @event.Id;
FullName = @event.FullName;
Email = @event.Email;
DateOfBirth = @event.DateOfBirth;
CreatedAtUtc = @event.CreatedAtUtc;
}

Expand Down

0 comments on commit ca56545

Please sign in to comment.