Skip to content

Commit c49fa2c

Browse files
committed
refactor: drop redundant casts on null and ViewBag
- VerificationService: (DateTime?)null -> default(DateTime?), same value without the cast - _EmailLayout.cshtml: extract 'ViewBag.BaseUrl as string' into a local 'baseUrl' instead of casting at every use site
1 parent f45f6b7 commit c49fa2c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

web/Areas/Effort/Services/VerificationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ await _auditService.LogRecordChangeAsync(
233233

234234
// Set verification timestamp
235235
var verifiedDate = DateTime.Now;
236-
var oldValues = new { EffortVerified = (DateTime?)null };
236+
var oldValues = new { EffortVerified = default(DateTime?) };
237237

238238
instructor.EffortVerified = verifiedDate;
239239

web/EmailTemplates/Views/Shared/_EmailLayout.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@
4141
@* Use width attribute for Outlook, max-width for modern clients. Class for responsive override. *@
4242
<table class="email-container" cellpadding="0" cellspacing="0" border="0" width="650" bgcolor="#ffffff" style="background-color: #ffffff; border: 1px solid #dee2e6; max-width: 650px; width: 100%;">
4343
@* UC Davis Weill Header Image *@
44+
@{
45+
var baseUrl = ViewBag.BaseUrl as string;
46+
}
4447
<tr>
4548
<td class="email-header" style="padding: 0; line-height: 0; font-size: 0;">
46-
@if (!string.IsNullOrWhiteSpace((string?)ViewBag.BaseUrl))
49+
@if (!string.IsNullOrWhiteSpace(baseUrl))
4750
{
48-
<img src="@(((string)ViewBag.BaseUrl).TrimEnd('/'))/images/email/email-header-weill.jpg"
51+
<img src="@(baseUrl.TrimEnd('/'))/images/email/email-header-weill.jpg"
4952
alt="UC Davis Weill School of Veterinary Medicine"
5053
width="650"
5154
style="display: block; width: 100%; max-width: 650px; height: auto; border: 0;" />

0 commit comments

Comments
 (0)