public ActionResult _Invoice(int id)
        {
            Product         product = new MallRepository().Get(id);
            cfgUnit         unit    = new UnitsRepository().getValid(product.unitSn);
            ProductApiModel pm      = new ProductApiModel();

            pm.unit    = unit;
            pm.product = product;



            string _Vi             = "ugZbqRhI6x5LGI94";
            string _key            = "CON3KthrvPulsAWQQiQ3jsswLIzxxgQK";
            string MerchantOrderNo = DateTime.Now.Ticks.ToString() + "0" + pm.product.id.ToString();
            var    user            = UserManager.FindById(User.Identity.GetUserId());
            var    tradeInfo       = new TradeInfo()
            {
                MerchantID  = "MS15822085",
                RespondType = "JSON",
                TimeStamp   = DateTime.Now.ToUnixTimeStamp(),
                Version     = "1.5",
                Amt         = (int)pm.product.Price,
                ItemDesc    = pm.product.ProductName,
                //InstFlag="3,6",
                //CreditRed = 0,
                Email           = user.Email,
                EmailModify     = 1,
                LoginType       = 0,
                MerchantOrderNo = MerchantOrderNo,
                TradeLimit      = 180
            };
            var postData     = tradeInfo.ToDictionary();
            var cryptoHelper = new CryptoHelper(_key, _Vi);
            var aesString    = cryptoHelper.GetAesString(postData);

            ViewData["TradeInfo"]   = aesString;
            ViewData["TradeSha"]    = cryptoHelper.GetSha256String(aesString);
            ViewData["Email"]       = tradeInfo.Email;
            ViewBag.TimeStamp       = tradeInfo.TimeStamp;
            ViewBag.MerchantOrderNo = tradeInfo.MerchantOrderNo;
            User_CashReturn re = new User_CashReturn
            {
                userId     = User.Identity.GetUserId(),
                MerchantID = MerchantOrderNo,
                productId  = pm.product.id,
                inpdate    = DateTime.Now,
            };

            new MallRepository().CreateReturnRecord(re);


            //ViewBag.sha256 = getHashSha256("HashKey=CON3KthrvPulsAWQQiQ3jsswLIzxxgQK&Amt="+pm.product.Price+"&MerchantID=MS15822085&MerchantOrderNo="+ time + "&TimeStamp="+ time + "&Version=1.5&HashIV=ugZbqRhI6x5LGI94");



            return(View(pm));
        }
 //加入返回購買記錄
 public void CreateReturnRecord(User_CashReturn instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException("instance");
     }
     else
     {
         Db.User_CashReturn.Add(instance);
         this.SaveChanges();
     }
 }