public async Task <IActionResult> Index([FromBody] EmailOrSmsSearchRequest request)
        {
            try
            {
                var response = await _emailSmsAppService.Search(request);

                return(Json(response));
            }
            catch (Exception e)
            {
                _logger.LogError(e, Common.Common.GetMethodName(), request);
                throw;
            }
        }
Example #2
0
        public async Task <EmailOrSmsSearchResponse> Search(EmailOrSmsSearchRequest request)
        {
            EmailOrSmsSearchResponse response = new EmailOrSmsSearchResponse();
            RefSqlPaging             paging   = new RefSqlPaging(request.PageIndex, 30);

            try
            {
                RefSqlPaging sqlpaging = new RefSqlPaging(request.PageIndex, request.PageSize);
                var          data      = await _emailSmsService.Search(request.Type, request.MessageType, request.PhoneNumber, request.Email, request.Status, request.CreatedDateUtc, request.SendDate, sqlpaging);

                response.TotalRow   = paging.TotalRow;
                response.EmailSmses = 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);
        }