Esempio n. 1
0
        public ActionResult <object> Update([FromBody] b_productVM model)
        {
            b_product_Entity entity = model.ConvertToT <b_product_Entity>();

            this.SetUpdateUserInfo(entity);
            CacheFactory.CacheInstance.RemovePrefix(Constant.Cache_Product_Prefix);
            return(this._repository.Update(entity, model.Product_ID).ResponseSuccess());
        }
Esempio n. 2
0
        public ActionResult <object> GetList([FromBody] b_productVM model, int pageindex = 1, int pagesize = 24)
        {
            b_product_Entity entity = model.ConvertToT <b_product_Entity>();

            var(list, total) = this._repository.GetList(entity, pageindex, pagesize);

            return(list.ResponseSuccess("", total));
        }
Esempio n. 3
0
        /// <summary>
        /// 修改
        /// <summary>
        public bool Update(b_product_Entity model, int Product_ID)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic["Product_ID"] = Product_ID;
            if (model.Category_ID != 0)
            {
                dic["Category_ID"] = model.Category_ID;
            }
            if (model.Product_Name_CH != null)
            {
                dic["Product_Name_CH"] = model.Product_Name_CH;
            }
            if (model.Product_Name_HK != null)
            {
                dic["Product_Name_HK"] = model.Product_Name_HK;
            }
            if (model.Product_New != null && model.Product_New.HasValue)
            {
                dic["Product_New"] = model.Product_New;
            }
            if (model.Product_Hot != null && model.Product_Hot.HasValue)
            {
                dic["Product_Hot"] = model.Product_Hot;
            }
            if (model.Product_Recommend != null && model.Product_Recommend.HasValue)
            {
                dic["Product_Recommend"] = model.Product_Recommend;
            }
            if (model.Product_Status != null && model.Product_Status.HasValue)
            {
                dic["Product_Status"] = model.Product_Status;
            }
            if (model.Product_Seq >= 0)
            {
                dic["Product_Seq"] = model.Product_Seq;
            }
            if (model.Update_Time != null && model.Update_Time.HasValue)
            {
                dic["Update_Time"] = model.Update_Time;
            }
            if (model.Update_UserId != null)
            {
                dic["Update_UserId"] = model.Update_UserId;
            }
            if (model.Update_User != null)
            {
                dic["Update_User"] = model.Update_User;
            }
            return(SQLHelperFactory.Instance.ExecuteNonQuery("Update_b_product", dic) > 0);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取列表
        /// <summary>
        public (IEnumerable <b_product_Entity>, int) GetList(b_product_Entity model, int pageindex, int pagesize)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (model.Product_ID != 0)
            {
                dic["Product_ID"] = model.Product_ID;
            }
            if (model.Category_ID != 0)
            {
                dic["Category_ID"] = model.Category_ID;
            }
            if (model.Product_Name_CH != null)
            {
                dic["Product_Name"] = model.Product_Name_CH;
            }
            if (model.Product_Name_HK != null)
            {
                dic["Product_Name"] = model.Product_Name_HK;
            }
            if (model.Product_New != null && model.Product_New.HasValue)
            {
                dic["Product_New"] = model.Product_New;
            }
            if (model.Product_Hot != null && model.Product_Hot.HasValue)
            {
                dic["Product_Hot"] = model.Product_Hot;
            }
            if (model.Product_Recommend != null && model.Product_Recommend.HasValue)
            {
                dic["Product_Recommend"] = model.Product_Recommend;
            }
            if (model.Product_Status != null && model.Product_Status.HasValue)
            {
                dic["Product_Status"] = model.Product_Status;
            }
            if (pageindex >= 0)
            {
                dic["StartIndex"] = pageindex <= 1 ? 0 : (pageindex - 1) * pagesize;
            }
            if (pagesize > 0)
            {
                dic["SelectCount"] = pagesize;
            }
            var list = SQLHelperFactory.Instance.QueryMultipleByPage <b_product_Entity>("Select_b_product_List", dic, out int total);

            return(list, total);
        }
Esempio n. 5
0
        /// <summary>
        /// 新增
        /// <summary>
        public int Insert(b_product_Entity model)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (model.Category_ID != 0)
            {
                dic["Category_ID"] = model.Category_ID;
            }
            if (model.Product_Name_CH != null)
            {
                dic["Product_Name_CH"] = model.Product_Name_CH;
            }
            if (model.Product_Name_HK != null)
            {
                dic["Product_Name_HK"] = model.Product_Name_HK;
            }
            if (model.Product_New != null && model.Product_New.HasValue)
            {
                dic["Product_New"] = model.Product_New;
            }
            if (model.Product_Hot != null && model.Product_Hot.HasValue)
            {
                dic["Product_Hot"] = model.Product_Hot;
            }
            if (model.Product_Recommend != null && model.Product_Recommend.HasValue)
            {
                dic["Product_Recommend"] = model.Product_Recommend;
            }
            if (model.Product_Status != null && model.Product_Status.HasValue)
            {
                dic["Product_Status"] = model.Product_Status;
            }
            if (model.Product_Seq >= 0)
            {
                dic["Product_Seq"] = model.Product_Seq;
            }
            if (model.Create_UserId != null)
            {
                dic["Create_UserId"] = model.Create_UserId;
            }
            if (model.Create_User != null)
            {
                dic["Create_User"] = model.Create_User;
            }
            return(SQLHelperFactory.Instance.ExecuteScalarByT <int>("Insert_b_product", dic));
        }