예제 #1
0
        public async Task <Poll> GetByIdAsync(int id)
        {
            var records = await _databaseRepository.GetCollectionAsync <PollRecord>(Functions.Poll.GetById,
                                                                                    DbParameterInfoHelper.Create(nameof(id), id));

            return(records.ToPoll().FirstOrDefault());
        }
예제 #2
0
        public async Task <User> GetByEmailAsync(string email)
        {
            var userRecord = await _databaseRepository.GetAsync <UserRecord>(Functions.UserRepository.GetByEmail,
                                                                             DbParameterInfoHelper.Create(nameof(email), email));

            return(_mapper.Map <User>(userRecord));
        }
예제 #3
0
 public Task <int> CreateAsync(PollDto poll)
 {
     return(_databaseRepository.GetAsync <int>(Functions.Poll.Create,
                                               DbParameterInfoHelper.Create(nameof(poll.Title), poll.Title),
                                               DbParameterInfoHelper.Create(nameof(poll.Status), poll.Status),
                                               DbParameterInfoHelper.Create(nameof(poll.Type), poll.Type),
                                               DbParameterInfoHelper.CreateJsonb(nameof(poll.Options), poll.Options)));
 }