public ActionResult EditTradeSignal(TradeSignalModel tradeSignalModel)
        {
            if (!ModelState.IsValid) return Json(new { status = false, errorString = Resource.ErrorMessageInvalid }, JsonRequestBehavior.AllowGet);

            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var account = ctx.ACCOUNT.Single(x => x.ID == tradeSignalModel.AccountId);
                    var itemEdit = ctx.SERVICE.Single(x => x.ID == tradeSignalModel.ID);

                    itemEdit.User = tradeSignalModel.User;
                    itemEdit.Comment = tradeSignalModel.Comment;
                    itemEdit.Currency = account.Currency;
                    itemEdit.AccountId = account.ID;
                    itemEdit.FixedPrice = tradeSignalModel.FixedPrice;
                    itemEdit.ServiceType = tradeSignalModel.ServiceType;

                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logger.Info("EditTradeSignal - не удалось получить данные с сервера", ex);
                return Json(new { status = false }, JsonRequestBehavior.AllowGet);
            }
            return Json(new { status = true }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult EditTradeSignal(TradeSignalModel tradeSignalModel)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { status = false, errorString = Resource.ErrorMessageInvalid }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var account  = ctx.ACCOUNT.Single(x => x.ID == tradeSignalModel.AccountId);
                    var itemEdit = ctx.SERVICE.Single(x => x.ID == tradeSignalModel.ID);

                    itemEdit.User        = tradeSignalModel.User;
                    itemEdit.Comment     = tradeSignalModel.Comment;
                    itemEdit.Currency    = account.Currency;
                    itemEdit.AccountId   = account.ID;
                    itemEdit.FixedPrice  = tradeSignalModel.FixedPrice;
                    itemEdit.ServiceType = tradeSignalModel.ServiceType;

                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logger.Info("EditTradeSignal - не удалось получить данные с сервера", ex);
                return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddNewTradeSignal(TradeSignalModel tradeSignalModel)
        {
            if (!ModelState.IsValid) return Json(new { status = false, errorString = Resource.ErrorMessageInvalid }, JsonRequestBehavior.AllowGet);
            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var account = ctx.ACCOUNT.Single(x => x.ID == tradeSignalModel.AccountId);

                    ctx.SERVICE.Add(new SERVICE
                        {
                            User = tradeSignalModel.User,
                            Comment = tradeSignalModel.Comment,
                            Currency = account.Currency,
                            AccountId = account.ID,
                            FixedPrice = tradeSignalModel.FixedPrice,
                            ServiceType = tradeSignalModel.ServiceType
                        });

                    ctx.SaveChanges();
                    return Json(new {status = true}, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                Logger.Info("AddNewTradeSignal", ex);
                return Json(new { status = false, errorString = Resource.ErrorMessageUnableGetDataFromServer }, JsonRequestBehavior.AllowGet);
            }
        }
        public ActionResult AddNewTradeSignal(TradeSignalModel tradeSignalModel)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { status = false, errorString = Resource.ErrorMessageInvalid }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                using (var ctx = DatabaseContext.Instance.Make())
                {
                    var account = ctx.ACCOUNT.Single(x => x.ID == tradeSignalModel.AccountId);

                    ctx.SERVICE.Add(new SERVICE
                    {
                        User        = tradeSignalModel.User,
                        Comment     = tradeSignalModel.Comment,
                        Currency    = account.Currency,
                        AccountId   = account.ID,
                        FixedPrice  = tradeSignalModel.FixedPrice,
                        ServiceType = tradeSignalModel.ServiceType
                    });

                    ctx.SaveChanges();
                    return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                Logger.Info("AddNewTradeSignal", ex);
                return(Json(new { status = false, errorString = Resource.ErrorMessageUnableGetDataFromServer }, JsonRequestBehavior.AllowGet));
            }
        }