/// <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())); }