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

            try
            {
                List <RatingModel> ratingList = _ratingsService.GetAll();


                if (ratingList == null)
                {
                    result = NotFound404(new ErrorResponse("The rating list is empty."));
                }
                else
                {
                    ItemsResponse <RatingModel> resp = new ItemsResponse <RatingModel>();
                    resp.Items = ratingList;
                    result     = Ok200(resp);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                result = StatusCode(500, new ErrorResponse(ex.Message.ToString()));
            }

            return(result);
        }