Exemple #1
0
        public bool CreateTrade(TradeCreate model)
        {
            var entity =
                new Trade()
            {
                OwnerId         = _userId,
                Ticker          = model.Ticker,
                TradeEntryPrice = model.TradeEntryPrice,
                CurrentPrice    = model.CurrentPrice,
                TradeEntryDate  = model.TradeEntryDate,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Trades.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Create(TradeCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateTradeService();

            if (service.CreateTrade(model))
            {
                TempData["SaveResult"] = "Your note was created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Note could not be created.");
            return(View(model));
        }
Exemple #3
0
 public async Task <iBanFirstApiResponse <Trade> > ExecuteTrade(TradeCreate trade)
 {
     return(await _client.MakeApiRequest <Trade>("trades/", Utilities.RequestMethod.POST, trade));
 }
Exemple #4
0
        /// <summary>
        /// 催单有礼的逻辑
        /// </summary>
        /// <param name="trade"></param>
        private string ActTradeCreateResult(Trade trade)
        {
            TradeCreate act = new TradeCreate(trade);

            return(act.Start());
        }
Exemple #5
0
        /// <summary>
        /// 催单有礼的逻辑
        /// </summary>
        /// <param name="trade"></param>
        private void ActTradeCreate(Trade trade)
        {
            TradeCreate act = new TradeCreate(trade);

            act.Start();
        }