Example #1
0
        /// <summary>
        /// 创建优惠券
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit(long merchantid, long?id = null, CardTypes type = CardTypes.DISCOUNT)
        {
            //var xx = this.WeChat.DeleteCardCoupon("p8ntH0ly5Wtdauv5pLm4NuX1W8jI");
            //xx = this.WeChat.DeleteCardCoupon("p8ntH0uMYrVs9q1jcw4W2iuUIbmg");
            //xx = this.WeChat.DeleteCardCoupon("p8ntH0nfTZdBv8NwTY2afZUoojD8");

            if (this.Auth.GetAuthenticatedUser() == null)
            {
                return(this.RedirectLocal("/access/sign?signin=true"));
            }

            var merchant = this.Merchant.GetDefaultMerchant(merchantid);

            //如果商户没有创建则返回到商户管理界面,
            if (merchant == null)
            {
                this.RedirectLocal("/merchant/mymerchant");
            }
            var viewModel = id == null
                ? type.Initialize(merchant).Convert()
                : this.CardCoupon.GetCardCounpon(id.Value).Convert();

            viewModel.MerchantId = merchant.Id;

            viewModel.SubMerchantBrandName = merchant.BrandName;
            return(View(type.GetViewName(), viewModel));
        }