SES-130 Endpoint Pancerzy #54

Merged
s426134 merged 4 commits from SES-130 into dev 2021-01-09 14:11:10 +01:00
Showing only changes of commit ab0aae1cdb - 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.ArmorViewModels; using SessionCompanion.ViewModels.ArmorViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -20,9 +22,21 @@ namespace SessionCompanion.Controllers
/// </summary> /// </summary>
/// <returns>Lista wszystkich pancerzy w bazie danych</returns> /// <returns>Lista wszystkich pancerzy w bazie danych</returns>
s426135 marked this conversation as resolved
Review

Brak Error Response

Brak Error Response
[HttpGet("getAllArmor")] [HttpGet("getAllArmor")]
public async Task<List<ArmorViewModel>> GetArmors() public async Task<Either<List<ArmorViewModel>, ErrorResponse>> GetArmors()
{ {
return _service.Get().ToList(); try
{
var armors = _service.Get().ToList();
return armors;
}
catch (Exception e)
{
return new ErrorResponse()
{
StatusCode = 204,
Message = e.Message
};
}
} }
} }
} }