public ReponseModel TK([FromBody] Dictionary <string, object> formData)
        {
            var response = new ReponseModel();

            try
            {
                var    page         = int.Parse(formData["page"].ToString());
                var    pageSize     = int.Parse(formData["pageSize"].ToString());
                string product_name = "";
                if (formData.Keys.Contains("product_name") && !string.IsNullOrEmpty(Convert.ToString(formData["product_name"])))
                {
                    product_name = Convert.ToString(formData["product_name"]);
                }
                decimal product_price = 0;
                if (formData.Keys.Contains("product_price") && (formData["product_price"]) != null)
                {
                    product_price = Convert.ToDecimal(formData["product_price"]);
                }
                long total = 0;
                var  data  = _productBusiness.TK(page, pageSize, out total, product_name, product_price);
                response.TotalItems = total;
                response.Data       = data;
                response.Page       = page;
                response.PageSize   = pageSize;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(response);
        }
Beispiel #2
0
        public ReponseModel Search([FromBody] Dictionary <string, object> formData)
        {
            var response = new ReponseModel();

            try
            {
                var    page     = int.Parse(formData["page"].ToString());
                var    pageSize = int.Parse(formData["pageSize"].ToString());
                string hoten    = "";
                if (formData.Keys.Contains("hoten") && !string.IsNullOrEmpty(Convert.ToString(formData["hoten"])))
                {
                    hoten = Convert.ToString(formData["hoten"]);
                }
                string taikhoan = "";
                if (formData.Keys.Contains("taikhoan") && !string.IsNullOrEmpty(Convert.ToString(formData["taikhoan"])))
                {
                    taikhoan = Convert.ToString(formData["taikhoan"]);
                }
                long total = 0;
                var  data  = _userBusiness.Search(page, pageSize, out total, hoten, taikhoan);
                response.TotalItems = total;
                response.Data       = data;
                response.Page       = page;
                response.PageSize   = pageSize;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(response);
        }
        public ReponseModel SearcBrand([FromBody] Dictionary <string, object> formData)
        {
            var response = new ReponseModel();

            try
            {
                var    page     = int.Parse(formData["page"].ToString());
                var    pageSize = int.Parse(formData["pageSize"].ToString());
                string brand_id = "";
                if (formData.Keys.Contains("brand_id") && !string.IsNullOrEmpty(Convert.ToString(formData["brand_id"])))
                {
                    brand_id = Convert.ToString(formData["brand_id"]);
                }
                long total = 0;
                var  data  = _productBusiness.SearcBrand(page, pageSize, out total, brand_id);
                response.TotalItems = total;
                response.Data       = data;
                response.Page       = page;
                response.PageSize   = pageSize;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(response);
        }
        public async Task <ReponseModel <string> > GenerateCard(User user)
        {
            ReponseModel <string> result = new ReponseModel <string>();

            result.Code = 1;
            if (string.IsNullOrEmpty(user.Address) || string.IsNullOrEmpty(user.Avator) ||
                string.IsNullOrEmpty(user.CardNo) || string.IsNullOrEmpty(user.Mobile) || string.IsNullOrEmpty(user.NickName) ||
                string.IsNullOrEmpty(user.OpenId))
            {
                result.Code    = -1;
                result.Message = "对不起,信息不全,请重试!";
                return(result);
            }
            await userService.CreateUser(user);

            result.Data = user.Unique;
            return(result);
        }