Add project files.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace JSMR.Infrastructure.Data.Repositories.Circles;
|
||||
|
||||
internal static class CircleLookup
|
||||
{
|
||||
public static async Task<int?> ResolveCircleIdAsync(AppDbContext context, int? circleId, string? nameOrMakerId, CancellationToken cancellationToken)
|
||||
{
|
||||
if (circleId.HasValue)
|
||||
return circleId.Value;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(nameOrMakerId))
|
||||
{
|
||||
return await context.Circles
|
||||
.Where(c => c.Name == nameOrMakerId || c.MakerId == nameOrMakerId)
|
||||
.Select(c => (int?)c.CircleId)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user