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()); }
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)); }
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))); }