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 68ab7ceebd - Show all commits

View File

@ -25,14 +25,19 @@ namespace SessionCompanion.Controllers
[HttpGet("getAllWeapons")]
public async Task<Either<List<WeaponViewModel>, ErrorResponse>> GetWeapons()

Brak Error Response

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