Пример #1
0
 public async Task <IEnumerable <ViewModel.CategoryReadModel> > GetCategoriesAsync()
 {
     using (var db = new SqlConnection(_connectionStringFactory.ToDatabase()))
     {
         var sql = "SELECT [Id], [Name] FROM [Interview].[Category]";
         return(await db.QueryAsync <ViewModel.CategoryReadModel>(sql));
     }
 }
Пример #2
0
 public async Task <IEnumerable <int> > GetQuestionIdsThatHasAnswerAsync()
 {
     using (var db = new SqlConnection(_connectionStringFactory.ToDatabase()))
     {
         var sql = $"SELECT Id FROM [Interview].[Question] WHERE [Answer] IS NOT NULL";
         return(await db.QueryAsync <int>(sql));
     }
 }
Пример #3
0
 public async Task <IEnumerable <vw_QuestionDetails> > GetQuestionsAsync()
 {
     using (var db = new SqlConnection(_connectionStringFactory.ToDatabase()))
     {
         var sql = "SELECT * FROM [Interview].[vw_QuestionDetails]";
         return(await db.QueryAsync <vw_QuestionDetails>(sql));
     }
 }
Пример #4
0
 public async Task <int> Handle(Query query, CancellationToken cancellationToken)
 {
     using (var db = new SqlConnection(_connectionStringFactory.ToDatabase()))
     {
         var sql = $"SELECT UserId FROM [vw_UserDetails]";
         return(await db.QueryFirstAsync <int>(sql));
     }
 }
Пример #5
0
 public async Task <ViewModel.CategoryInputModel> GetCategoryAsync(int id)
 {
     using (var db = new SqlConnection(_connectionStringFactory.ToDatabase()))
     {
         var sql = $"SELECT [Id], [Name] FROM [Interview].[Category] WHERE [Id] = { id }";
         return(await db.QueryFirstAsync <ViewModel.CategoryInputModel>(sql));
     }
 }