public async Task <IActionResult> GetGeneralStatistics([FromQuery] NhaCungCapStatisticsParams userParams) { try { var result = await _repo.GetGeneralStatistics(userParams); return(StatusCode(200, new SuccessResponseDto { Message = "Lấy dữ liệu thống kê tổng quan về " + _entityName + " thành công!", Result = new SuccessResponseResultWithSingleDataDto { Data = result } })); } catch (Exception e) { return(StatusCode(500, new FailedResponseDto { Message = "Lấy dữ liệu thống kê tổng quan về " + _entityName + " thất bại!", Result = new FailedResponseResultDto { Errors = e } })); } }
public async Task <Object> GetGeneralStatistics(NhaCungCapStatisticsParams userParams) { var result = _context.DanhSachNhaCungCap.AsQueryable(); var totalProvider = result.Count(); return(new { Total = totalProvider }); }