Skip to content

Commit

Permalink
Merge branch '2.0.6' of https://github.com/bcgov/schoolbus into 2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ionwyn committed Oct 3, 2024
2 parents ab79ea5 + 01e5ca0 commit 7675aab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Server/SchoolBusAPI/Services/InspectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ public virtual IActionResult InspectionsIdPutAsync(int id, Inspection item)
var exists = _context.Inspections.Any(a => a.Id == id);
if (exists && id == item.Id)
{
item.CreatedDate = DateTime.SpecifyKind(item.CreatedDate, DateTimeKind.Unspecified);
item.InspectionDate = DateTime.SpecifyKind(item.InspectionDate, DateTimeKind.Unspecified);
item.PreviousNextInspectionDate = DateTime.SpecifyKind(item.PreviousNextInspectionDate.GetValueOrDefault(), DateTimeKind.Unspecified);
_context.Inspections.Update(item);
// Save the changes
_context.SaveChanges();
Expand Down Expand Up @@ -258,6 +261,7 @@ public virtual IActionResult InspectionsPostAsync(Inspection item)
}

var exists = _context.Inspections.Any(a => a.Id == item.Id);
item.InspectionDate = DateTime.SpecifyKind(item.InspectionDate, DateTimeKind.Unspecified);
if (exists)
{
_context.Inspections.Update(item);
Expand All @@ -269,6 +273,8 @@ public virtual IActionResult InspectionsPostAsync(Inspection item)
{
// Inspection has a special field, createdDate which is set to now.
item.CreatedDate = DateTime.UtcNow;
// TH-120363
item.CreatedDate = DateTime.SpecifyKind(item.CreatedDate, DateTimeKind.Unspecified);
_context.Inspections.Add(item);
}
_context.SaveChanges();
Expand Down
4 changes: 4 additions & 0 deletions Server/SchoolBusAPI/Services/SchoolBusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ private void AdjustSchoolBus(SchoolBus item)
item.CCWData = null;
}
}

item.NextInspectionDate = DateTime.SpecifyKind(item.NextInspectionDate.GetValueOrDefault(), DateTimeKind.Unspecified);
item.PermitIssueDate = DateTime.SpecifyKind(item.PermitIssueDate.GetValueOrDefault(), DateTimeKind.Unspecified);
}
}

Expand Down Expand Up @@ -844,6 +847,7 @@ public virtual IActionResult SchoolbusesIdNewpermitPutAsync(int id)

item.PermitNumber = permit;
item.PermitIssueDate = DateTime.UtcNow;
item.PermitIssueDate = DateTime.SpecifyKind(item.PermitIssueDate.GetValueOrDefault(), DateTimeKind.Unspecified);

_context.SchoolBuss.Update(item);
_context.SaveChanges();
Expand Down

0 comments on commit 7675aab

Please sign in to comment.