コード例 #1
0
        public async Task <bool> RequestDifficultyRatingPost(GolfCourseHoleRatingViewModel userDifficultyRating, string userId)
        {
            var golfCourseComment = new GolfCourseComment
            {
                DifficultyRating = userDifficultyRating.Difficulty,
                GolfCourseId     = userDifficultyRating.GolfCourseId,
                HoleComment      = userDifficultyRating.Comment,
                HoleNumber       = userDifficultyRating.HoleNumber,
                UserId           = userId
            };

            return(await _golfCourseRepository.StoreDifficultyRating(golfCourseComment));
        }
コード例 #2
0
        public async Task <bool> StoreDifficultyRating(GolfCourseComment difficultyRatingComment)
        {
            try
            {
                _dataEntities.GolfCourseComments.Add(difficultyRatingComment);
                await _dataEntities.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                e.GetBaseException();
                return(false);
            }
        }