Fixed a bunch of warnings

This commit is contained in:
Andre Beging
2022-05-31 15:08:55 +02:00
parent cd22c2f215
commit 7208f1e86d
21 changed files with 202 additions and 140 deletions

View File

@@ -2,12 +2,12 @@ using System.Security.Claims;
using FoodsharingSiegen.Contracts;
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.Data;
using FoodsharingSiegen.Server.Data.Service;
using FoodsharingSiegen.Server.Service;
using FoodsharingSiegen.Shared.Helper;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.EntityFrameworkCore;
namespace FoodsharingSiegen.Server.Service
namespace FoodsharingSiegen.Server.Auth
{
/// <summary>
/// The token auth state provider class (a. beging, 02.04.2022)
@@ -84,11 +84,13 @@ namespace FoodsharingSiegen.Server.Service
/// </summary>
/// <param name="user">The user</param>
/// <returns>A task containing an operation result of bool</returns>
public async Task<OperationResult<bool>> CheckForceLogout(User user)
public async Task<OperationResult<bool>> CheckForceLogout(User? user)
{
try
{
var anyR = await Context.Users.AnyAsync(x => x.Id == user.Id && x.ForceLogout);
if (user == null) return new OperationResult<bool>(new Exception());
var anyR = await Context.Users!.AnyAsync(x => x.Id == user.Id && x.ForceLogout);
return new OperationResult<bool>(anyR);
}
catch (Exception e)