public async Task <IActionResult> GetDevDtrList([FromQuery] SDevDtrVsList sDevDtrVsList) { _logger.LogInformation(String.Format(@"****** DTRController GetDevDtrList fired!! ******")); var data = await _articledDAO.GetDevDtrVsListDto(sDevDtrVsList); PagedList <DevDtrVsListDto> result = PagedList <DevDtrVsListDto> .Create(data, sDevDtrVsList.PageNumber, sDevDtrVsList.PageSize, sDevDtrVsList.IsPaging); Response.AddPagination(result.CurrentPage, result.PageSize, result.TotalCount, result.TotalPages); return(Ok(result)); }
public async Task <List <DevDtrVsListDto> > GetDevDtrVsListDto(SDevDtrVsList sDevDtrVsList) { string strWhere = " WHERE 1=1 "; if (!(String.IsNullOrEmpty(sDevDtrVsList.Article))) { strWhere += " AND t1.ARTICLE = N'" + sDevDtrVsList.Article.Trim() + "' "; } if (!(String.IsNullOrEmpty(sDevDtrVsList.Season))) { strWhere += " AND t2.SEASON = N'" + sDevDtrVsList.Season.Trim() + "' "; } if (!(String.IsNullOrEmpty(sDevDtrVsList.ModelNo))) { strWhere += " AND t1.MODELNO like N'" + sDevDtrVsList.ModelNo.Trim() + "%' "; } if (!(String.IsNullOrEmpty(sDevDtrVsList.ModelName))) { strWhere += " AND t2.MODELNAME = N'" + sDevDtrVsList.ModelName.Trim() + "' "; } if (!(String.IsNullOrEmpty(sDevDtrVsList.DeveloperId))) { strWhere += " AND t2.DEVELOPERID = N'" + sDevDtrVsList.DeveloperId.Trim() + "' "; } if (!(String.IsNullOrEmpty(sDevDtrVsList.DevTeamId))) { strWhere += " AND t2.DEVTEAMID = N'" + sDevDtrVsList.DevTeamId.Trim() + "' "; } string strSQL = string.Format(@" SELECT DISTINCT t2.SEASON as Season ,t1.ARTICLE as Article ,t1.MODELNO as ModelNo ,t2.MODELNAME as ModelName ,t3.LOGIN as DeveloperId ,t2.DEVTEAMID as DevTeamId FROM ARTICLED as t1 LEFT JOIN MODELDAH as t2 on t1.MODELNO = t2.MODELNO LEFT JOIN STACCRTH as t3 on t2.DEVELOPERID = t3.WORKPNO"); strSQL += strWhere; var data = await _context.GetDevDtrVsListDto.FromSqlRaw(strSQL).ToListAsync(); return(data); }