public async Task <ServiceResponse> GetAllByCompany(string name, int?idCompany, int idUser, int draw, int start, int length) { var sr = new ServiceResponse(); try { var results = _mapper.Map <IEnumerable <ProductDto> >(await _repositoryProduct.GetAllByCompany(name, idUser, idCompany, start, length)); sr.Data = new { draw, recordsTotal = results.Count(), recordsFiltered = results.Count(), data = results }; } catch (Exception ex) { sr.AddError(ex); } return(sr); }