Refactoring

This commit is contained in:
Andre Beging
2025-03-28 17:18:49 +01:00
parent 859b0c3712
commit e19268f3eb
4 changed files with 42 additions and 42 deletions

View File

@@ -48,13 +48,13 @@ namespace FoodsharingSiegen.Server.Data.Service
var saveR = await Context.SaveChangesAsync();
if (saveR > 0)
return new OperationResult<Audit>(audit);
return new(audit);
return new OperationResult<Audit>(new Exception("Couldn't add audit"));
return new(new Exception("Couldn't add audit"));
}
catch (Exception e)
{
return new OperationResult<Audit>(e);
return new(e);
}
}
@@ -84,13 +84,13 @@ namespace FoodsharingSiegen.Server.Data.Service
var mat = query?.ToList();
if (mat != null) return new OperationResult<List<Audit>>(mat);
if (mat != null) return new(mat);
return new OperationResult<List<Audit>>(new Exception("Couldn't load audits"));
return new(new Exception("Couldn't load audits"));
}
catch (Exception e)
{
return new OperationResult<List<Audit>>(e);
return new(e);
}
}