コード例 #1
0
        public ActionResult SendMoney()
        {
            var viewModel = new PacificCodeSendMoneyViewModel
            {
                CodeNumber = "1767312140506642",
                Amount = 1000,
                PhoneNumber = "0932130483",
                PhoneNumberConfirm = "0932130483"
            };

            return View(viewModel);
        }
コード例 #2
0
        public ActionResult SendMoney(PacificCodeSendMoneyViewModel sendObject)
        {
            try
            {
                // Service

                if (sendObject.PhoneNumber == sendObject.PhoneNumberConfirm)
                {
                    PacificCode newPacificCode = PacificCodeBUS.SendMoney(sendObject.CodeNumber,
                        sendObject.PhoneNumber, sendObject.Amount);

                    if (newPacificCode != null)
                    {
                        // Nếu thành công thì gửi mail thông báo
                        Mail newMail = new Mail();
                        newMail.Subject = "Send to Customer";
                        newMail.Body = "GSM: " + sendObject.PhoneNumber + "<br/>"
                            + "Bạn vừa nhận được PacificCode: " + newPacificCode.CodeNumber + ". "
                            + "Có giá trị " + newPacificCode.ActualAmount + " và "
                            + "han su dung den ngay " + String.Format("{0:dd-MM-yyyy}", newPacificCode.ExpireDate);

                        MPMail.SendForEmail(newMail);
                        ViewData["message"] = "Thuc hien chuyen tien thanh cong!...";
                        return View(sendObject);
                    }
                }

                ViewData["message"] = "Sai thong tin nhap...";
                return View(sendObject);
            }
            catch
            {
                ViewData["message"] = "Co loi xay ra!...";
                return View(sendObject);
            }
        }