예제 #1
0
        public object Get(SearchQuestions request)
        {
            var query = Db.From <Question>();

            if (request.Tags != null && request.Tags.Count > 0)
            {
                query.Join <QuestionTag>((q, t) => q.QuestionId == t.QuestionId)
                .Where <QuestionTag>(x => Sql.In(x.Tag, request.Tags));
            }

            var response = new SearchQuestionsResponse
            {
                Results = Db.Select(query)
            };

            return(response);
        }
        private async void GetQuestions()
        {
            var task = new SearchQuestions().GetDataAsync(txtSearchQuery.Text);

            try
            {
                var result = await task;

                dataGridView2.DataSource = result;

                if (result.Count == 0)
                {
                    timer2.Stop();
                    lblLoading2.Hide();
                    lblCountGrid2.Text = "0 - No results found!";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please check if you are connected to the internet. If you have not used the VPN Google may block your IP, stop using the app immediately! " + ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }