Esempio n. 1
0
 private async void LoadDataToDataGrid()
 {
     try
     {
         dataGridView1.DataSource = await professorService.GetProfessors();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 2
0
        public async Task <IActionResult> Get([FromQuery] int offset, [FromQuery] int limit, [FromQuery] string keyword)
        {
            if (limit == 0)
            {
                limit = 20;
            }

            if (keyword != null)
            {
                var res = await _service.GetProfessors(keyword, limit, offset);

                bool hasNext = (res.Item1.Count != limit);
                return(Ok(new ResultList <Professor>(200, null, res.Item1, hasNext, res.Item2, "")));
            }

            var _res = await _service.GetProfessors(limit, offset);

            bool _hasNext = (_res.Item1.Count != limit);

            return(Ok(new ResultList <Professor>(200, null, _res.Item1, _hasNext, _res.Item2, "")));
        }