SES-128 Endpoint Broni #52

Merged
s426134 merged 7 commits from SES-128 into dev 2021-01-09 14:07:07 +01:00
Showing only changes of commit 20d81f4bf5 - Show all commits

View File

@ -23,9 +23,16 @@ namespace SessionCompanion.Controllers
/// </summary>
/// <returns>Lista wszystkich broni w bazie danych</returns>
[HttpGet("getAllWeapons")]
public async Task<List<WeaponViewModel>> GetWeapons()
public async Task<Either<List<WeaponViewModel>, ErrorResponse>> GetWeapons()

Brak Error Response

Brak Error Response
{
return _service.Get().ToList();
var weapons = _service.Get().ToList();
if (!weapons.Any())
return new ErrorResponse()
{
StatusCode = 204,
Message = "No weapons in database"
};
return weapons;
}
}
}