diff --git a/SessionCompanion/SessionCompanion/Controllers/OtherEquipmentController.cs b/SessionCompanion/SessionCompanion/Controllers/OtherEquipmentController.cs index 893836f..d21d202 100644 --- a/SessionCompanion/SessionCompanion/Controllers/OtherEquipmentController.cs +++ b/SessionCompanion/SessionCompanion/Controllers/OtherEquipmentController.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Mvc; +using SessionCompanion.Extensions.EitherType; using SessionCompanion.Services.Interfaces; +using SessionCompanion.ViewModels.ApiResponses; using SessionCompanion.ViewModels.OtherEquipmentViewModels; using System; using System.Collections.Generic; @@ -20,9 +22,21 @@ namespace SessionCompanion.Controllers /// /// Lista wszystkich innych przedmiotów w bazie danych [HttpGet("getAllOtherEquipment")] - public async Task> GetOtherEquipment() + public async Task, ErrorResponse>> GetOtherEquipment() { - return _service.Get().ToList(); + try + { + var otherEq = _service.Get().ToList(); + return otherEq; + } + catch (Exception e) + { + return new ErrorResponse() + { + StatusCode = 204, + Message = e.Message + }; + } } } }