コード例 #1
0
        public async Task CreateAsync(string name)
        {
            var newType = new TypeTravel
            {
                Name = name,
            };

            await this.typeTravelRepository.AddAsync(newType);

            await this.typeTravelRepository.SaveChangesAsync();
        }
コード例 #2
0
        public async Task SetRateAsync(string userId, string assessorId, double value)
        {
            var userRate = this.userRatingRepository.All().FirstOrDefault(x => x.AssessorId == assessorId && x.UserId == userId);

            if (userRate == null)
            {
                userRate = new TypeTravel
                {
                    AssessorId = assessorId,
                    UserId     = userId,
                    Value      = value,
                };

                await this.userRatingRepository.AddAsync(userRate);
            }

            userRate.Value = value;

            await this.userRatingRepository.SaveChangesAsync();
        }