示例#1
0
        public ResponseModel Searchadmin([FromBody] Dictionary <string, object> formData)
        {
            var response = new ResponseModel();

            try
            {
                var    page     = int.Parse(formData["page"].ToString());
                var    pageSize = int.Parse(formData["pageSize"].ToString());
                string ten      = "";
                if (formData.Keys.Contains("ten") && !string.IsNullOrEmpty(Convert.ToString(formData["ten"])))
                {
                    ten = Convert.ToString(formData["ten"]);
                }
                float gia = 0;
                if (formData.Keys.Contains("gia") && !string.IsNullOrEmpty(Convert.ToString(formData["gia"])))
                {
                    ten = Convert.ToString(formData["gia"]);
                }
                long total = 0;
                var  data  = _itemBusiness.Searchadmin(page, pageSize, out total, ten, gia);
                response.TotalItems = total;
                response.Data       = data;
                response.Page       = page;
                response.PageSize   = pageSize;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(response);
        }