Example #1
0
        public PageReturnModel GetDataAll(PageModelParameter model)
        {
            string msgError = "";

            try
            {
                var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "sp_page_search",
                                                                    "@page_index", model.Page?.PageIndex,
                                                                    "@page_size", model.Page?.PageSize,
                                                                    "@tenpage", model.Data.Page_Name);
                var result = new PageReturnModel();
                if (!string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(msgError);
                }
                else
                {
                    result.Data     = dt.ConvertTo <PageModel>().ToList();
                    result.TotalRow = int.Parse(dt.Rows[0].ItemArray[dt.Rows[0].ItemArray.Length - 1].ToString());
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public async Task <IActionResult> GetData(RequestDataModel request)
        {
            var pageModelParamater = new PageModelParameter();
            var settings           = new JsonSerializerSettings();
            var searchObject       = new PageModel
            {
            };

            settings.DateFormatString = "dd/MM/yyyy";
            searchObject = JsonConvert.DeserializeObject <PageModel>(request.model, settings);
            var page = new PageParameter
            {
                PageIndex = request.start,
                PageSize  = request.length
            };

            pageModelParamater.Page = page;
            pageModelParamater.Data = searchObject;
            var hostAPI = url;
            var data    = await ApiProvider.PostAsync <PageReturnModel>(hostAPI, ApiConstant.GetAllPage, pageModelParamater);

            return(Json(data));
        }
Example #3
0
 public PageReturnModel GetDataAll(PageModelParameter model)
 {
     return(_bus.GetDataAll(model));
 }