Ejemplo n.º 1
0
        public ActionResult <ItemResponse <RatingModel> > GetById(int id)
        {
            ActionResult result = null;

            RatingModel rating = _ratingsService.GetById(id);

            try
            {
                if (rating == null)
                {
                    result = NotFound404(new ErrorResponse("There is no id that matches " + id + " in our database."));
                }
                else
                {
                    ItemResponse <RatingModel> resp = new ItemResponse <RatingModel>();
                    resp.Item = rating;
                    result    = Ok200(resp);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                result = StatusCode(500, new ErrorResponse(ex.Message.ToString()));
            }

            return(result);
        }
 public Model.Ratings GetById(int Id)
 {
     return(_service.GetById(Id));
 }