//Update Simple / Complex Discounts public async Task <Result <Guid> > UpdateSimpleDiscountAsync(Guid existingDiscountId, string username, Guid storeId, RuleContext discountType, double precent, string category = "", Guid productId = new Guid()) { if (discountsManager.IsComplexed(existingDiscountId)) { return(new Result <Guid>(new Guid(), true, "Impossible to update a discount which other discounts are complexed on.")); } var res = await marketRules.UpdateSimpleDiscountAsync(await MarketStores.Instance.GetStoreById(storeId), existingDiscountId, username, storeId, discountType, precent, category, productId); Guid discountId = res.Ret; await StorePredicatesManager.Instance.SaveRequest(++counter, existingDiscountId, "UpdateSimpleDiscountAsync", username, storeId, discountType, precent, category, productId, discountId); var discountData = new DiscountData(discountId, username, storeId, discountType, RuleType.Simple, precent, category, productId, int.MaxValue, 0, default(DateTime), default(DateTime)); await discountsManager.RemoveDiscount(discountId); await discountsManager.AddDiscount(discountData); return(res); }