public async Task <Poll> GetByIdAsync(int id) { var records = await _databaseRepository.GetCollectionAsync <PollRecord>(Functions.PollRepository.GetById, DbParameterHelper.Create(nameof(id), id)); return(ToPoll(records).FirstOrDefault()); }
public async Task <User> GetByEmailAsync(string email) { var userRecord = await _databaseRepository.GetAsync <UserRecord>(Functions.UserRepository.GetByEmail, DbParameterHelper.Create(nameof(email), email)); return(_mapper.Map <User>(userRecord)); }
public async Task <User> GetByIdAsync(int id) { var userRecord = await _databaseRepository.GetAsync <UserRecord>(Functions.UserRepository.GetById, DbParameterHelper.Create(nameof(id), id)); return(_mapper.Map <User>(userRecord)); }
public Task <int> CreateAsync(Poll poll) { return(_databaseRepository.GetAsync <int>(Functions.PollRepository.Create, DbParameterHelper.Create(nameof(poll.Title), poll.Title), DbParameterHelper.Create(nameof(poll.Status), poll.Status), DbParameterHelper.Create(nameof(poll.Type), poll.Type), DbParameterHelper.CreateJsonb(nameof(poll.Options), poll.Options))); }
public Task <int> AddAsync(User user) { return(_databaseRepository.GetAsync <int>(Functions.UserRepository.Add, DbParameterHelper.Create(nameof(user.Email), user.Email), DbParameterHelper.Create(nameof(user.PasswordHash), user.PasswordHash), DbParameterHelper.Create(nameof(user.FirstName), user.FirstName), DbParameterHelper.Create(nameof(user.LastName), user.LastName), DbParameterHelper.Create("UserRoleId", user.Role.Id))); }
public Task <int> AddAnswerAsync(PollAnswer pollAnswer) { return(_databaseRepository.GetAsync <int>(Functions.PollAnswerRepository.Add, DbParameterHelper.Create(nameof(pollAnswer.PollOptionId), pollAnswer.PollOptionId), DbParameterHelper.Create(nameof(pollAnswer.UserId), pollAnswer.UserId))); }
public async Task <ICollection <PollAnswer> > GetByPollIdAsync(int pollId) { return((await _databaseRepository.GetCollectionAsync <PollAnswer>(Functions.PollAnswerRepository.GetByPollId, DbParameterHelper.Create(nameof(pollId), pollId))) .ToList()); }
public Task <PollAnswer> GetByIdAsync(int id) { return(_databaseRepository.GetAsync <PollAnswer>(Functions.PollAnswerRepository.GetById, DbParameterHelper.Create(nameof(id), id))); }