public ActionResult <ItemResponse <AverageMerchantRating> > GetCurrentMerchantRating() { ActionResult result = null; int merchant = _authService.GetCurrentUserId(); AverageMerchantRating rating = _ratingsService.GetAvgMerchantRatingByMerchant(merchant); try { if (rating == null) { result = NotFound404(new ErrorResponse("There is merchant that matches " + merchant + " in our database.")); } else { ItemResponse <AverageMerchantRating> resp = new ItemResponse <AverageMerchantRating>(); resp.Item = rating; result = Ok200(resp); } } catch (Exception ex) { Logger.LogError(ex.ToString()); result = StatusCode(500, new ErrorResponse(ex.Message.ToString())); } return(result); }