public async Task <IActionResult> getOneArtwork(int id)
        {
            try
            {
                var obj = await artworkRepository.GetArtworkById(id);

                if (obj == null)
                {
                    logger.LogError("The artwork does not exist");
                    return(NotFound());
                }

                logger.LogInformation($"Returned the artwork with id {id}");
                return(Ok(obj));
            }
            catch (Exception exception)
            {
                logger.LogError($"Something went wrong internally in the server: ", exception.Message);
                return(StatusCode(500, "Internal server error"));
            }
        }
Exemplo n.º 2
0
 public void GetArtistsById()
 {
     Assert.IsNotNull(_artworkRepository.GetArtworkById(_artworkRepository.GetArtworkByTitle("Unit Testing").Id));
 }