private async void BtnSearch_Click(object sender, EventArgs e) { NotificationSearchRequest searchRequest = new NotificationSearchRequest() { Title = txtTitle.Text }; List <Model.Notification> notifications = await _apiService.GetAll <List <Model.Notification> >(searchRequest); if (notifications.Count == 0) { MessageBox.Show("There are no results for this search", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { dgvNotifications.AutoGenerateColumns = false; dgvNotifications.DataSource = notifications; } }
private async void BtnSearch_Click(object sender, EventArgs e) { NotificationSearchRequest request = new NotificationSearchRequest { StartDate = dtpStartDate.Value.Date, EndDate = dtpEndDate.Value.Date }; if (request.EndDate.Value.Date < request.StartDate.Value.Date) { MessageBox.Show("End date field must be greater than field Start date"); return; } var result = await _notificationService.GetAll <List <Notification> >(request); dgvNotifications.AutoGenerateColumns = false; dgvNotifications.DataSource = result; if (result.Count == 0) { MessageBox.Show("There are not results for this search", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }