public ActionResult <ItemResponse <Venue> > GetById(int id)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                Venue aVenue = _service.GetById(id);

                if (aVenue == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Venue Not Found");
                }
                else
                {
                    response = new ItemResponse <Venue> {
                        Item = aVenue
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse($"Server Error: {ex.Message}");
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
Ejemplo n.º 2
0
 public async Task <Venue> GetVenueById(int id)
 {
     return(await venuesService.GetById(id));
 }