コード例 #1
0
        public ActionResult OrderFinish(TradingSystemOrderPoco model)
        {
            if (ModelState.IsValid)
            {
                var currentUser = _usersService.GetUserByLogin(HttpContext.User.Identity.Name);
                var account = _accountsService.GetById(model.AccountId);

                if (account.UserId != currentUser.Id)
                {
                    return this.View("TradingSystemOrder");
                }

                var tradingSystemEntity = new TradingSystems
                    {
                        AccountId = model.AccountId,
                        UserId = currentUser.Id,
                        CreateDate = DateTime.Now,
                        StatusId = 1,
                        SystemId = model.TradingSystemId,
                        IsDeleted = false,
                        IsNew = false
                    };
                _tradingSystemService.Add(tradingSystemEntity);

                // Заявка
                var applicationEntity = new TradingSystemPool
                    {
                        AccountId = model.AccountId,
                        UserId = currentUser.Id,
                        ApplicationDate = DateTime.Now,
                        TradingSystemId = tradingSystemEntity.Id
                    };
                _tradingSystemService.AddToPool(applicationEntity);

                return RedirectToAction("OrderStatus");
            }

            return this.View("TradingSystemOrder");
        }
コード例 #2
0
 public void Add(TradingSystems entity)
 {
     db.TradingSystems.Add(entity);
     db.SaveChanges();
 }
コード例 #3
0
 public void AddWithoutSaving(TradingSystems entity)
 {
     db.TradingSystems.Add(entity);
 }
コード例 #4
0
        public void Delete(TradingSystems entity)
        {
            var tSystem = db.TradingSystems.FirstOrDefault(x => x.Id == entity.Id);

            if (tSystem != null)
            {
                tSystem.IsDeleted = true;
            }

            db.SaveChanges();
        }