public CompetitorListApiModel GetCompetitors(int id, int currentPage = 1, int pageSize = 0, string query = "") { var dbCompetitors = _dealRepository.GetCompetitors(id, currentPage, pageSize, query); var apiModel = new CompetitorListApiModel(); if (dbCompetitors.competitors.Count() > 0) { apiModel.competitors = dbCompetitors.competitors.Select(c => new CompetitorListApiModel.CompetitorInfo() { id = c.COMPETITOR.ID, name = c.COMPETITOR.Name, strengths = c.COMPETITOR.Strengths, weaknesses = c.COMPETITOR.Weaknesses, website = c.COMPETITOR.Website, suggestions = c.Suggestions, threat = c.ThreatLevel }).ToList(); } apiModel.pageInfo = dbCompetitors.p; return(apiModel); }