Exception handling

This commit is contained in:
2023-12-13 22:04:06 +01:00
parent 86cc431200
commit c112adc4d3
9 changed files with 133 additions and 33 deletions

View File

@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using System;
using WD7UVN_HFT_2023241.Logic;
using System.Linq;
using WD7UVN_HFT_2023241.Models;
using Microsoft.AspNetCore.Mvc.Diagnostics;
namespace WD7UVN_HFT_2023241.Endpoint
{
@@ -17,9 +19,16 @@ namespace WD7UVN_HFT_2023241.Endpoint
}
[HttpGet()]
public IQueryable<Employee> WhoWorksInMaintainerTeam([FromQuery] int id)
public IQueryable<Employee>? WhoWorksInMaintainerTeam([FromQuery] int id)
{
return LogicServices.WhoWorksInMaintainerTeam(id);
try
{
return LogicServices.WhoWorksInMaintainerTeam(id);
}
catch (NullReferenceException)
{
return null;
}
}
}
}