Exemple #1
0
 // POST api/deposit
 public IHttpActionResult Post([FromBody] DepositBindingModel depositModel)
 {
     try
     {
         var deposit = Mapper.Map <DomainDeposit>(depositModel);
         _depositService.Add(deposit);
         return(Ok());
     }
     catch (BankClientException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public async Task <ActionResult> Success(string Content, bool isServerCall = false)
        {
            //Content = DESHelper.DecryptDES(Content);
            string path = Server.MapPath("/log");

            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            path = System.IO.Path.Combine(path, DateTime.Now.ToString("yyyyMMdd") + ".txt");
            try
            {
                System.IO.File.AppendAllText(path, string.Format("第一步:{0}\r\n", Content));
                AccountDepostiViewModel depostiViewModel = JsonConvert.DeserializeObject <AccountDepostiViewModel>(Content);
                System.IO.File.AppendAllText(path, string.Format("第二步:{0}\r\n", JsonConvert.SerializeObject(depostiViewModel)));
                Btcamp.Gold.Core.Entitys.Deposit model = new Btcamp.Gold.Core.Entitys.Deposit();
                Account account = accountService.Get(a => a.PhoneNumber == depostiViewModel.Email);
                model.AccountId   = account.Id;
                model.OrderNumber = depostiViewModel.Billno;
                decimal rate = await mt4Service.GetUSDCNY();

                model.USDAmount = Convert.ToDouble((decimal)depostiViewModel.Amount / rate);
                model.Amount    = depostiViewModel.Amount;
                model.IsAudit   = false;
                model.Time      = DateTime.Now;
                depositService.Add(model);
                unitOfWork.Commit();
                System.IO.File.AppendAllText(path, string.Format("第三步:{0}\r\n", "ok"));
                return(Json(Content, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                System.IO.File.AppendAllText(path, ex.ToString());
                return(Json(Content, JsonRequestBehavior.AllowGet));
            }
        }