Exemplo n.º 1
0
        public async Task <IActionResult> GetBox([FromRoute] long boxId)
        {
            try
            {
                var box = await _boxService.GetBox(User.GetId(), boxId);

                return(Ok(box));
            }
            catch (BoxNotFoundException e)
            {
                _logger.LogWarning($"Failed to get box (id:{e.Id}) for user {User.GetId()}");
                return(NotFound());
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                return(new InternalServerErrorResult());
            }
        }
 [HttpGet("{id}")]//, Name = "Get")]
 public Box GetBox(int id)
 {
     return(boxService.GetBox(id)); //JsonSerializer.Serialize(boxService.GetBox(id));
 }