Exemplo n.º 1
0
        /// <summary>
        /// 添加品牌信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public Stream deleteBrand(ImpContext context)
        {
            MongBrand mongBrand = new MongBrand(Constants.daname);
            //反序列化
            BrandModel brandModel = JsonConvert.DeserializeObject <BrandModel>(context.json.Replace("\0", ""), new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            mongBrand.delete(brandModel);
            return(new ToStream().ToStreams(mongBrand.obtainAll()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加品牌信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public Stream addBrand(ImpContext context)
        {
            MongBrand mongBrand = new MongBrand(Constants.daname);
            //反序列化
            BrandModel brandModel = JsonConvert.DeserializeObject <BrandModel>(context.json.Replace("\0", ""), new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            if (string.IsNullOrEmpty(brandModel.guid))
            {
                brandModel.guid = Guid.NewGuid().ToString();
                mongBrand.insert(brandModel);
            }
            else
            {
                mongBrand.update(brandModel);
            }

            return(new ToStream().ToStreams(mongBrand.obtainAll()));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取所有的品牌数据
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public Stream obtainBrand(ImpContext context)
        {
            MongBrand mongBrand = new MongBrand(Constants.daname);

            return(new ToStream().ToStreams(mongBrand.obtainAll()));
        }