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");
        }
 public void Add(TradingSystems entity)
 {
     db.TradingSystems.Add(entity);
     db.SaveChanges();
 }
 public void AddWithoutSaving(TradingSystems entity)
 {
     db.TradingSystems.Add(entity);
 }
        public void Delete(TradingSystems entity)
        {
            var tSystem = db.TradingSystems.FirstOrDefault(x => x.Id == entity.Id);

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

            db.SaveChanges();
        }