SES-131 Endpoint OtherEquipment #55

Merged
s426134 merged 3 commits from SES-131 into dev 2021-01-08 20:06:25 +01:00
Showing only changes of commit 6c3e23a1ea - Show all commits

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Extensions.EitherType;
using SessionCompanion.Services.Interfaces; using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.ApiResponses;
using SessionCompanion.ViewModels.OtherEquipmentViewModels; using SessionCompanion.ViewModels.OtherEquipmentViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -20,9 +22,21 @@ namespace SessionCompanion.Controllers
/// </summary> /// </summary>
/// <returns>Lista wszystkich innych przedmiotów w bazie danych</returns> /// <returns>Lista wszystkich innych przedmiotów w bazie danych</returns>
s426135 marked this conversation as resolved
Review

Brak Error Response

Brak Error Response
[HttpGet("getAllOtherEquipment")] [HttpGet("getAllOtherEquipment")]
public async Task<List<OtherEquipmentViewModel>> GetOtherEquipment() public async Task<Either<List<OtherEquipmentViewModel>, 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
};
}
} }
} }
} }