public async void GetAll_ReturnsData() { // arrange ICommandFactory <Sku> commandFactory = new CommandFactory <Sku>(); var validationServiceMoq = new Mock <IValidationService>(); var makeServiceMoq = new Mock <IMakeService>(); makeServiceMoq.Setup(x => x.Get(It.IsAny <string>())) .ReturnsAsync(new Result <Make>(ResultCode.Success, context.Makes.FirstOrDefault())); var modelServiceMoq = new Mock <IModelService>(); modelServiceMoq.Setup(x => x.Get(It.IsAny <string>())) .ReturnsAsync(new Result <Model>(ResultCode.Success, context.Models.FirstOrDefault())); var sut = new SkuService(context, commandFactory, validationServiceMoq.Object, makeServiceMoq.Object, modelServiceMoq.Object); // act var result = await sut.GetAll(); // assert Assert.NotEmpty(result.Data); }
/// <summary> /// 获取订单单据明细信息 /// </summary> public string GetOrderDetailInfoById() { var orderService = new OrderService(CurrentUserInfo); IList <OrderDetailInfo> data = null; string content = string.Empty; string key = string.Empty; if (FormatParamValue(Request("order_id")) != null && FormatParamValue(Request("order_id")) != string.Empty) { key = FormatParamValue(Request("order_id")).ToString().Trim(); } var order = orderService.GetOrderInfoById(key); if (order != null) { data = order.orderDetailList; foreach (var orderDetailItem in order.orderDetailList) { orderDetailItem.display_name = SkuService.GetItemAllName(orderDetailItem); } } content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", order.orderDetailList.ToJSON(), order.orderDetailList.Count); return(content); }
public async void GetAll_WhenNotFoundReturnsNotFound() { // arrange var allSku = await context.Set <Sku>().ToListAsync(); ICommandFactory <Sku> commandFactory = new CommandFactory <Sku>(); var validationServiceMoq = new Mock <IValidationService>(); var makeServiceMoq = new Mock <IMakeService>(); makeServiceMoq.Setup(x => x.Get(It.IsAny <string>())) .ReturnsAsync(new Result <Make>(ResultCode.Success, context.Makes.FirstOrDefault())); var modelServiceMoq = new Mock <IModelService>(); modelServiceMoq.Setup(x => x.Get(It.IsAny <string>())) .ReturnsAsync(new Result <Model>(ResultCode.Success, context.Models.FirstOrDefault())); var sut = new SkuService(context, commandFactory, validationServiceMoq.Object, makeServiceMoq.Object, modelServiceMoq.Object); context.Skus.RemoveRange(allSku); await context.SaveChangesAsync(); // act var result = await sut.GetAll(); // assert Assert.Equal(ResultCode.NotFound, result.ResultCode); }
/// <summary> /// GetSkuSelectData /// </summary> private string GetSkuSelectData() { var skuService = new SkuService(new SessionManager().CurrentUserLoginInfo); IList <ItemInfo> list; string key = string.Empty; string content = string.Empty; if (Request("query") != null && Request("query") != string.Empty) { key = Request("query").ToString().Trim(); } list = skuService.GetItemInfoByLike(key); //foreach (var item in list) //{ // item.display_name = SkuService.GetItemAllName(item); //} var jsonData = new JsonData(); jsonData.totalCount = list.Count.ToString(); jsonData.data = list; content = jsonData.ToJSON(); return(content); }
/// <summary> /// 获取未打包的Sku数量 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="User_Id">用户标识</param> /// <param name="Unit_Id">组织标识</param> /// <returns>未打包Sku数量</returns> public int GetSkuNotPackagedCount(string Customer_Id, string User_Id, string Unit_Id) { LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id); int iCount = 0; SkuService skuService = new SkuService(); iCount = skuService.GetSkuNotPackagedCount(loggingSessionInfo); return(iCount); }
/// <summary> /// 需要打包的Sku集合 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="User_Id">用户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="strartRow">开始行</param> /// <param name="rowsCount">每页行数</param> /// <returns>未打包的Sku集合</returns> public IList <SkuInfo> GetSkuListPackaged(string Customer_Id, string User_Id, string Unit_Id, int strartRow, int rowsCount) { IList <SkuInfo> skuInfoList = new List <SkuInfo>(); LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id); SkuService skuService = new SkuService(); skuInfoList = skuService.GetSkuListPackaged(loggingSessionInfo, rowsCount, strartRow); return(skuInfoList); }
/// <summary> /// 更新SKu表打包标识方法 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="User_Id">用户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="bat_id">批次号</param> /// <returns>true=成功,false=失败</returns> public bool SetSkuIfFlagInfo(string Customer_Id, string User_Id, string Unit_Id, string bat_id) { LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id); bool bReturn = false; SkuService skuService = new SkuService(); bReturn = skuService.SetSkuIfFlagInfo(loggingSessionInfo, bat_id); return(bReturn); }
private void DoWork(object sender, DoWorkEventArgs e) { var splitted = new List <string>(); var fileList = new SkuService().GetCSV("https://www.cordners.co.uk/exportcsv/"); string[] tempStr; tempStr = fileList.Split('\t'); var skus = new List <string>(); foreach (var item in tempStr) { if (!string.IsNullOrEmpty(item)) { if (item.Contains('\n') && item.Split('\n')[0].Length > 6) { var sku = item.Split('\n')[0].Substring(0, 6); if (!skus.Contains(sku)) { splitted.Add(sku); skus.Add(sku); } } } } var skuService = new SkuService(); skuService.DeleteDescriptions(); var count = 0; var check = splitted.Count / 100; var loop = 0; for (var i = 0; i < splitted.Count; i++) { if (check == count) { loop++; worker.ReportProgress(loop); count = 0; } else { count++; } Insert(splitted[i], SqlQueries.InsertSKU); } var things = new SkuService().GetStockSync(); var online = new SkuService().GetOnlineStockSync(); var missing = new SkuService().GetMissingStockSync(online, things); Things = new ObservableCollection <SpecailOrders>(missing.OrderBy(x => x.MasterSupplier)); worker.ReportProgress(100); }
/// <summary> /// 获取SKU属性定义 /// </summary> public string GetSkuPropCfgData(string orderId) { var skuService = new SkuService(new SessionManager().CurrentUserLoginInfo); SkuPropCfgInfo item = new SkuPropCfgInfo(); item.sku_prop_1 = "0"; item.sku_prop_2 = "0"; item.sku_prop_3 = "0"; item.sku_prop_4 = "0"; item.sku_prop_5 = "0"; string key = string.Empty; string content = string.Empty; var list = skuService.GetSkuInfoByOne(orderId); var sku = new SkuInfo(); if (list != null && list.Count > 0) { sku = list[0]; if (sku.prop_1_id != null && sku.prop_1_id.Length > 0) { item.sku_prop_1 = "1"; item.sku_prop_1_name = sku.prop_1_name; } if (sku.prop_2_id != null && sku.prop_2_id.Length > 0) { item.sku_prop_2 = "1"; item.sku_prop_2_name = sku.prop_2_name; } if (sku.prop_3_id != null && sku.prop_3_id.Length > 0) { item.sku_prop_3 = "1"; item.sku_prop_3_name = sku.prop_3_name; } if (sku.prop_4_id != null && sku.prop_4_id.Length > 0) { item.sku_prop_4 = "1"; item.sku_prop_4_name = sku.prop_4_name; } if (sku.prop_5_id != null && sku.prop_5_id.Length > 0) { item.sku_prop_5 = "1"; item.sku_prop_5_name = sku.prop_5_name; } } var jsonData = new JsonData(); jsonData.totalCount = item == null ? "0" : "1"; jsonData.data = item; content = jsonData.ToJSON(); return(content); }
public void ListSkus_CallsListSkusMethodFromServicesLayer_WichReturnsAnEmptyList() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.ListSkus()).Returns(emptySkus); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); List <string> result = sut.ListSkus(); Assert.AreEqual(emptySkus.Count, result.Count); }
public void ListSkus_WithoutParameters_InvokesListSkusMethodFromBusinessLayer() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.ListSkus()).Returns(oneSku); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); List <string> result = sut.ListSkus(); business.Verify(m => m.ListSkus(), Times.Once()); }
public void ListSkus_WithoutParameters_ReturnsAStringList() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(o => o.ListSkus()).Returns(oneSku); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); List <string> result = sut.ListSkus(); Assert.IsTrue(result is List <string>, "result is not a 'string list'"); }
public async Task GetTransactionsBySku_WithAnSkuId_InvokesGetTransactionsBySkuMethodFromBusinessLayer() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.GetTransactionsBySku(CommonFakes.firstSku)).Returns(Task.FromResult(fullSku)); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); Sku result = await sut.GetTransactionsBySku(CommonFakes.firstSku); business.Verify(m => m.GetTransactionsBySku(CommonFakes.firstSku), Times.Once); }
public void ListSkus_CallsListSkusMethodFromServicesLayer_WichReturnsAListWithOnItem() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.ListSkus()).Returns(oneSku); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); List <string> result = sut.ListSkus(); Assert.AreEqual(oneSku.Count, result.Count); Assert.AreEqual(oneSku.First(), result.First()); }
public async Task InvokeGetByIdAsync() { var sku = new Sku(_testSkuName); sku.AddSkuBasePrice(It.IsAny <decimal>()); _mockSkuRepository.Setup(m => m.FirstAsync(It.IsAny <SkuWithPricesSpecification>())).ReturnsAsync(sku); var skuService = new SkuService(_mockSkuRepository.Object); await skuService.CalculatePrice(DateTime.UtcNow, sku.Id, 1); _mockSkuRepository.Verify(m => m.FirstAsync(It.IsAny <SkuWithPricesSpecification>()), Times.Once); }
public string GetItemInfoByBarcode(string barcode) { cPos.Model.LoggingSessionInfo loggingSessionInfo = new cPos.Model.LoggingSessionInfo(); var itemService = new ItemService(); var skuService = new SkuService(); ItemInfo item = new ItemInfo(); SkuInfo sku = skuService.GetSkuByBarcode(barcode); item.SkuInfoByBarcode = sku; if (sku != null) { item.ItemInfoByBarcode = itemService.GetItemInfoById(loggingSessionInfo, sku.item_id); } return(XMLGenerator.Serialize(item)); }
private async Task LoadData() { IsBusy = true; await Task.Factory.StartNew(() => { var salesOnline = new SkuService().GetItemsOnSale(); var stock = new SkuService().GetImportProductsAllQuery(); var sales = new SkuService().GetSales(stock, salesOnline); var q1 = from t in sales select t.MasterSupplier; Authors = new ObservableCollection <string>(q1.Distinct().OrderBy(x => x)); var q2 = from t in sales select t.Category; Countries = new ObservableCollection <string>(q2.Distinct().OrderBy(x => x)); var q3 = from t in sales select t.Season; Years = new ObservableCollection <string>(q3.Distinct().OrderBy(x => x)); var q4 = from t in sales select t.Color; Colour = new ObservableCollection <string>(q4.Distinct().OrderBy(x => x)); var q5 = from t in sales select t.Style; Style = new ObservableCollection <string>(q5.Distinct().OrderBy(x => x)); var q6 = from t in sales select t.StockType; StockType = new ObservableCollection <string>(q6.Distinct().OrderBy(x => x)); var q7 = from t in sales select t.Store; Store = new ObservableCollection <string>(q7.Distinct().OrderBy(x => x)); Things = new ObservableCollection <Sales>(sales.OrderBy(x => x.SKU)); }).ContinueWith((task) => { IsBusy = false; }, TaskScheduler.FromCurrentSynchronizationContext()); //Online = new ObservableCollection<SpecailOrders>(online); }
public async Task GetTransactionsBySku_WithAnSkuId_ReturnsAFullSkuData() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.GetTransactionsBySku(CommonFakes.firstSku)).Returns(Task.FromResult(fullSku)); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); Sku result = await sut.GetTransactionsBySku(CommonFakes.firstSku); Assert.AreEqual(fullSku.Name, result.Name); Assert.AreEqual(fullSku.Total, result.Total); Assert.AreEqual(fullSku.Transactions.Count, result.Transactions.Count); Assert.AreEqual(fullSku.Transactions.First().Sku, result.Transactions.First().Sku); Assert.AreEqual(fullSku.Transactions.First().Amount, result.Transactions.First().Amount); Assert.AreEqual(fullSku.Transactions.First().Currency, result.Transactions.First().Currency); }
public void syncwelFareSKU() { var interfaceName = "syncwelFareSKU"; var loggingSessionInfo = BaseService.GetLoggingSession(); var skuService = new SkuService(loggingSessionInfo); var dsSkus = new DataSet(); var skus = new SkuList(); skus.skulist = new List <Sku>(); //更新接口同步表 var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo); if (queryList != null && queryList.Length > 0) { //存在,根据日期条件查询 dsSkus = skuService.GetSynWelfareSkuList(queryList.FirstOrDefault().LatestTime.ToString()); } else { //不存在,查询所有数据 dsSkus = skuService.GetSynWelfareSkuList(string.Empty); } if (dsSkus != null && dsSkus.Tables.Count > 0 && dsSkus.Tables[0].Rows.Count > 0) { skus.skulist = DataTableToObject.ConvertToList <Sku>(dsSkus.Tables[0]); //上传数据 var content = skus.ToJSON(); var result = UploadData(interfaceName, skus.ToJSON()); //写入接口日志 var logEntity = new ZInterfaceLogEntity() { LogId = Utils.NewGuid(), InterfaceName = interfaceName, Params = content, ResultCode = result.code, ResultDesc = result.description }; InsertInterfaceLog(logEntity, loggingSessionInfo); } }
public void ListSkus_CallsListSkusMethodFromServicesLayer_WichThrowsAnException() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.ListSkus()).Throws(exception); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); try { sut.ListSkus(); Assert.IsTrue(false, "No exception thrown. Exception exception was expected."); } catch (Exception result) { Assert.AreSame(exception, result); } }
public async Task GetTransactionsBySku_CallsGetTransactionsBySkuMethodFromServicesLayer_WichThrowsAnException() { Mock <ISkuBusiness> business = new Mock <ISkuBusiness>(); business.Setup(m => m.GetTransactionsBySku(CommonFakes.firstSku)).Throws(exception); ISkuService sut = new SkuService(business.Object, commonFakes.Mapper); try { await sut.GetTransactionsBySku(CommonFakes.firstSku); Assert.IsTrue(false, "No exception thrown. Exception exception was expected."); } catch (Exception result) { Assert.AreSame(exception, result); } }
public SkuServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new SkuService(this.StripeClient); this.createOptions = new SkuCreateOptions { Attributes = new Dictionary <string, string> { { "attr1", "value1" }, { "attr2", "value2" }, }, Currency = "usd", Inventory = new SkuInventoryOptions { Quantity = 100, Type = "finite", }, PackageDimensions = new SkuPackageDimensionsOptions { Height = 100, Length = 100, Weight = 100, Width = 100, }, Price = 1234, Product = "prod_123", }; this.updateOptions = new SkuUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new SkuListOptions { Limit = 1, }; }
private async Task LoadData() { IsBusy = true; await Task.Factory.StartNew(() => { var onlineSKUs = new SkuService().OnlineSKUs(); var online = new SkuService().GetOnlineSKuValues(onlineSKUs); var q1 = from t in online select t.MasterSupplier; Authors = new ObservableCollection <string>(q1.Distinct().OrderBy(x => x)); var q2 = from t in online select t.Category; Countries = new ObservableCollection <string>(q2.Distinct().OrderBy(x => x)); var q3 = from t in online select t.Season; Years = new ObservableCollection <string>(q3.Distinct().OrderBy(x => x)); var q4 = from t in online select t.Color; Colour = new ObservableCollection <string>(q4.Distinct().OrderBy(x => x)); var q5 = from t in online select t.Style; Style = new ObservableCollection <string>(q5.Distinct().OrderBy(x => x)); var q6 = from t in online select t.StockType; StockType = new ObservableCollection <string>(q6.Distinct().OrderBy(x => x)); Things = new ObservableCollection <SpecailOrders>(online.OrderBy(x => x.Ref)); }).ContinueWith((task) => { IsBusy = false; }, TaskScheduler.FromCurrentSynchronizationContext()); //Online = new ObservableCollection<SpecailOrders>(online); }
public SkuServiceTest() { this.service = new SkuService(); this.createOptions = new SkuCreateOptions { Attributes = new Dictionary <string, string> { { "attr1", "value1" }, { "attr2", "value2" }, }, Currency = "usd", Inventory = new InventoryOptions { Quantity = 100, Type = "finite", }, PackageDimensions = new PackageDimensionOptions { Height = 100, Length = 100, Weight = 100, Width = 100, }, Price = 1234, Product = "prod_123", }; this.updateOptions = new SkuUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new SkuListOptions { Limit = 1, }; }
public MissingOnline(IDataService dataService) { this.worker = new BackgroundWorker(); this.worker.WorkerReportsProgress = true; this.worker.ProgressChanged += this.ProgressChanged; _skuService = new SkuService(); InitializeCommands(); DataService = dataService; LoadData(); StartCommand = new CommandHandler(() => { this.worker.RunWorkerAsync(); }, () => { return(!this.worker.IsBusy); }); //-------------------------------------------------------------- // This 'registers' the instance of this view model to recieve messages with this type of token. This // is used to recieve a reference from the view that the collectionViewSource has been instantiated // and to recieve a reference to the CollectionViewSource which will be used in the view model for // filtering Messenger.Default.Register <ViewCollectionViewSourceMessageToken>(this, Handle_ViewCollectionViewSourceMessageToken); }
/// <summary> /// 通过ID获取SKU /// </summary> public string GetSkuByIdData() { var skuService = new SkuService(CurrentUserInfo); SkuInfo item; string key = string.Empty; string content = string.Empty; if (FormatParamValue(Request("id")) != null && FormatParamValue(Request("id")) != string.Empty) { key = FormatParamValue(Request("id")).ToString().Trim(); } item = skuService.GetSkuInfoById(key); item.display_name = SkuService.GetItemAllName(item); var jsonData = new JsonData(); jsonData.totalCount = item == null ? "0" : "1"; jsonData.data = item; content = jsonData.ToJSON(); return(content); }
public RetailBrandController(StyleService styleService, SkuService skuService) { _styleService = styleService; _skuService = skuService; }
private void LoadData() { IsBusy = true; _sizeLoader = new Dictionary <string, object>(); _supplierLoader = new Dictionary <string, object>(); _seasonLoader = new Dictionary <string, object>(); _categoryLoader = new Dictionary <string, object>(); _styleLoader = new Dictionary <string, object>(); _stockTypeLoader = new Dictionary <string, object>(); _colourLoader = new Dictionary <string, object>(); Cordners = new ObservableCollection <SpecailOrders>(); var onlineSKUs = new SkuService().OnlineSKUs(); var things = new SkuService().GetOnlineSKuValues(onlineSKUs); var q1 = from t in things select t.Season; var obj = q1.Distinct().Zip(q1.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _seasonLoader.Add(ob.Key, ob.Value); } var q2 = from t in things select t.MasterSupplier; obj = q2.Distinct().Zip(q2.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _supplierLoader.Add(ob.Key, ob.Value); } var q3 = from t in things select t.Category; obj = q3.Distinct().Zip(q3.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _categoryLoader.Add(ob.Key, ob.Value); } var q4 = from t in things select t.Style; obj = q4.Distinct().Zip(q4.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _styleLoader.Add(ob.Key, ob.Value); } var q5 = from t in things select t.StockType; obj = q5.Distinct().Zip(q5.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _stockTypeLoader.Add(ob.Key, ob.Value); } var q6 = from t in things select t.Color; obj = q6.Distinct().Zip(q6.Distinct(), (k, v) => new { k, v }) .ToDictionary(x => x.k, x => x.v).OrderBy(x => x.Key); foreach (var ob in obj) { _colourLoader.Add(ob.Key, ob.Value); } Cordners = new ObservableCollection <SpecailOrders>(things.OrderBy(x => x.Ref)); }
/// <summary> /// 获取库存盘点单明细 /// </summary> public string GetCcDetailInfoById() { var ccService = new CCService(CurrentUserInfo); IList <CCDetailInfo> data = null; string content = string.Empty; string order_id = string.Empty; string unit_id = string.Empty; string warehouse_id = string.Empty; if (FormatParamValue(Request("order_id")) != null && FormatParamValue(Request("order_id")) != string.Empty) { order_id = FormatParamValue(Request("order_id")).ToString().Trim(); } if (FormatParamValue(Request("unit_id")) != null && FormatParamValue(Request("unit_id")) != string.Empty) { unit_id = FormatParamValue(Request("unit_id")).ToString().Trim(); } if (FormatParamValue(Request("warehouse_id")) != null && FormatParamValue(Request("warehouse_id")) != string.Empty) { warehouse_id = FormatParamValue(Request("warehouse_id")).ToString().Trim(); } int maxRowCount = 100000; int startRowIndex = 0; if (order_id == null || order_id.Trim().Length == 0) { order_id = string.Empty; } CCInfo order = null; CCDetailInfo dataStock = null; if (order_id.Trim().Length > 0) { order = ccService.GetCCDetailInfoByOrderId(order_id, maxRowCount, startRowIndex); } else if (unit_id.Trim().Length > 0 && warehouse_id.Trim().Length > 0) { dataStock = ccService.GetCCDetailListStockBalance(CurrentUserInfo, order_id, unit_id, warehouse_id, maxRowCount, startRowIndex); } if (order != null) { data = order.CCDetailInfoList; foreach (var detailItem in order.CCDetailInfoList) { detailItem.display_name = SkuService.GetItemAllName(detailItem); } } else if (dataStock != null) { data = dataStock.CCDetailInfoList; foreach (var detailItem in dataStock.CCDetailInfoList) { detailItem.display_name = SkuService.GetItemAllName(detailItem); } } content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", data.ToJSON(), data.Count); return(content); }