public ActionResult AddRating(int id, AddRatingBindingModel bindingModel)
        {
            if (bindingModel != null)
            {
                string userId = User.Identity.GetUserId();
                this.ratingService.AddRating(id, bindingModel, userId);

                return(Json($"You rated with {bindingModel.Value}"));
            }

            return(Json("Error"));
        }
        public void AddRating(int id, AddRatingBindingModel bindingModel, string userId)
        {
            Rating newRating = Mapper.Map <AddRatingBindingModel, Rating>(bindingModel);

            newRating.UserId = userId;
            Book currentBook = this.Context.Books.Find(id);

            newRating.Books.Add(currentBook);

            this.Context.Ratings.Add(newRating);
            this.Context.SaveChanges();
        }