Esempio n. 1
0
        public bool UpdateUserRating(UserRatingResourceModel userRatingRM)
        {
            try
            {
                var userRating = this._userRatingRepo.GetUserRating(userRatingRM.Id);

                userRating.Comment     = userRatingRM.Comment;
                userRating.RatingValue = userRatingRM.RatingValue;

                this._userRatingRepo.UpdateUserRating(userRating);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool CreateUserRating(UserRatingResourceModel userRatingRM, int CoffeeId)
        {
            try
            {
                var coffee = this._coffeeRepo.GetCoffee(CoffeeId);

                var userRating = new UserRating()
                {
                    Comment     = userRatingRM.Comment,
                    RatingValue = userRatingRM.RatingValue
                };

                var userRatingId = this._userRatingRepo.CreateUserRaiting(userRating);

                this._coffeeUserRatingRepo.CreateCoffeeUserRating(coffee.Id, userRatingId);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }