public IActionResult SaveRating(RatingDetailViewModel ratingDetailViewModel)
        {
            var userid = _generalFunctionController.Instance.getClaimType(User, CommonConstants.UserClaims.Key);
            var c      = _customerService.GetBysId(userid);

            if (c.KeyId != 0)
            {
                ratingDetailViewModel.CustomerFK = c.KeyId;
                var book = _bookService.GetById(ratingDetailViewModel.BookFK);
                if (ratingDetailViewModel.KeyId == 0)
                {
                    _ratingDetailService.Add(ratingDetailViewModel);
                    book.RatingNumber++;
                }
                else
                {
                    _ratingDetailService.Update(ratingDetailViewModel);
                }
                book.Rating = _ratingDetailService.CalculateBookRatingByBookId(ratingDetailViewModel.BookFK);
                _bookService.Update(book);
                _bookService.Save();
                return(new OkObjectResult("/BeyeuBookstore/BookDetail?id=" + ratingDetailViewModel.BookFK));
            }
            return(new OkObjectResult("fail"));
        }
        public IActionResult UpdateBookRatingById(int id)
        {
            double rating = _ratingDetailService.CalculateBookRatingByBookId(id);

            _bookService.UpdateBookRating(rating, id);
            _bookService.Save();
            return(new OkObjectResult("true"));
        }