public async Task <IActionResult> Search([FromBody] BannerSearchRequest request) { try { var response = await _bannerAppService.SearchBanner(request); return(Json(response)); } catch (Exception e) { _logger.LogError(e, Common.Common.GetMethodName(), request); throw; } }
public async Task <BannerSearchResponse> SearchBanner(BannerSearchRequest request) { BannerSearchResponse response = new BannerSearchResponse(); try { RefSqlPaging paging = new RefSqlPaging(request.PageIndex, request.PageSize); var data = await _bannerService.SearchBanner(request.Id, request.BannerName, request.Status, paging); response.TotalRow = paging.TotalRow; response.Banners = data.Select(p => p.ToModel()).ToArray(); response.PageIndex = request.PageIndex; response.PageSize = request.PageSize; response.SetSucess(); } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return(response); }