Esempio n. 1
0
        public CategoryReturnModel GetDataAll(CategoryModelParameter model)
        {
            string msgError = "";

            try
            {
                var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "sp_category_search",
                                                                    "@page_index", model.Page?.PageIndex,
                                                                    "@page_size", model.Page?.PageSize,
                                                                    "@tencate", model.Data.Category_Name);
                var result = new CategoryReturnModel();
                if (!string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(msgError);
                }
                else
                {
                    result.Data     = dt.ConvertTo <CategoryModel>().ToList();
                    result.TotalRow = int.Parse(dt.Rows[0].ItemArray[dt.Rows[0].ItemArray.Length - 1].ToString());
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> GetData(RequestDataModel request)
        {
            var categoryModelParamater = new CategoryModelParameter();
            var settings     = new JsonSerializerSettings();
            var searchObject = new CategoryModel
            {
            };

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

            categoryModelParamater.Page = page;
            categoryModelParamater.Data = searchObject;
            var hostAPI = "https://localhost:44322";
            var data    = await ApiProvider.PostAsync <CategoryReturnModel>(hostAPI, ApiConstant.GetAllCategory, categoryModelParamater);

            return(Json(data));
        }
Esempio n. 3
0
 public CategoryReturnModel GetDataAll(CategoryModelParameter model)
 {
     return(_bus.GetDataAll(model));
 }