/// <summary> /// Получает все купленные неактивированные пользователем продуктов /// </summary> /// <param name="active">Статус активациии таблице user_chest (Не активный)</param> /// <param name="lang">Локаль для перевода описания и имени продукта</param> /// <returns>Список не активированных продуктов</returns> public IHttpActionResult GetChestInactiveItems(bool active = false, string lang = "EN") { string userId = User.Identity.GetUserId(); var result = new Dictionary <int, ChestFields>(); UserChest userChest = _getModel(); var chestItems = userChest.GetCountProductId(userId, active); foreach (ChestFields chestItem in chestItems) { var productId = chestItem.ProductId; var productCount = chestItem.Count; ChestFields productProperties = userChest.GetProductProperties(productId, productCount, lang.ToUpper()); result.Add(productId, productProperties); } // result.Add("chestItems", _getModel().ChestInactiveItems(userId)); // result.Add("chestItemCounts", chestItems); // // var store = new Store(); // var chestItemProperties = new ArrayList(); // // foreach (ChestFields chestItem in chestItems) // { // chestItemProperties.Add(store.GetPropertyById(chestItem.ProductId)); // } // result.Add("chestItemDescriptions", chestItemProperties); return(Json(result)); }
public IHttpActionResult PostActivateProduct(ActivateUserProduct data) { //Todo доабвить локаль для перевода string userId = User.Identity.GetUserId(); Store store = new Store(); StoreItem parameters = store.GetProductParametersByProductId(data.ProductId); int productType = parameters.product_typeId; Dictionary <string, dynamic> properties = System.Web.Helpers.Json.Decode(parameters.property); UserChest userChest = new UserChest(); ChestFields chestItem = userChest.GetChestData(userId, data.ProductId, false); if (MONEY_SG_TYPE == productType) { return(Json("MONEY_SG_TYPE")); } else if (PREMIUM_TYPE == productType) { Premium premium = new Premium(); premium.InitializePremium(userId, chestItem.Id, properties); } // else if (ACCOUNT_TYPE_SERVICE == productType) // { // return Json(productType); // } else if (BOOSTER_TYPE == productType) { Booster booster = new Booster(); booster.InitializeBooster(userId, chestItem, parameters, data.ProductId); } // else if (SKIN_TYPE == productType) // { // return Json(productType); // } var chestItems = userChest.GetCountProductId(userId, false); var result = new Dictionary <int, ChestFields>(); foreach (ChestFields chstItem in chestItems) { var productId = chstItem.ProductId; var productCount = chstItem.Count; ChestFields productProperties = userChest.GetProductProperties(productId, productCount, data.Lang.ToUpper()); result.Add(productId, productProperties); } return(Json(result)); }