Skip to content

Commit

Permalink
Fixing issues from merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
RossClark01 authored Nov 14, 2024
1 parent 02cdf51 commit 4d72b8f
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions Gordon360/Services/HousingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -853,39 +853,45 @@ await context.RA_Pref_Contact.AddAsync(new RA_Pref_Contact
/// phone number if no preference is set.</returns>
public async Task<string> GetPreferredContactAsync(string raId)
{
// Check if there is a preferred contact method for the given RA
var contactPreference = await context.RA_Pref_Contact
.FirstOrDefaultAsync(cp => cp.Ra_ID == raId);
// Check if there is a preferred contact method for the given RA
var contactPreference = await context.RA_Pref_Contact
.FirstOrDefaultAsync(cp => cp.Ra_ID == raId);

if (contactPreference != null)
if (contactPreference != null)
{
// Determine the preferred method and get corresponding contact info
if (contactPreference.Pref_contact == "phone")
{
// Determine the preferred method and get corresponding contact info
if (contactPreference.Pref_contact == "phone")
{
// Fetch RA's phone number from the RA_Students table
var ra = await context.RA_Students
.FirstOrDefaultAsync(r => r.ID == raId);
// Fetch RA's phone number from the RA_Students table
var ra = await context.RA_Students
.FirstOrDefaultAsync(r => r.ID == raId);

return ra?.PhoneNumber ?? "Phone number not found";
return ra?.PhoneNumber ?? "Phone number not found";
}
else if (contactPreference.Pref_contact == "teams")
{
// Fetch RA's email from the RA_Students table
var ra = await context.RA_Students
.FirstOrDefaultAsync(r => r.ID == raId);

if (ra?.Email != null)
{
// Generate Teams link using the email
return $"https://teams.microsoft.com/l/chat/0/0?users={ra.Email}";
}
else if (contactPreference.Pref_contact == "teams")
else
{
// Fetch RA's email from the RA_Students table
var ra = await context.RA_Students
.FirstOrDefaultAsync(r => r.ID == raId);

if (ra?.Email != null)
{
// Generate Teams link using the email
return $"https://teams.microsoft.com/l/chat/0/0?users={ra.Email}";
}
else
{
return "Email not found";
}
return "Email not found";
}
}
}
}

// If no preference exists, return the phone number by default
var defaultContact = await context.RA_Students
.FirstOrDefaultAsync(r => r.ID == raId);

return defaultContact?.PhoneNumber ?? "Default phone number not found";
}

/// <summary>
/// Gets the on-call RA's ID for specified hall.
Expand Down

0 comments on commit 4d72b8f

Please sign in to comment.