Ejemplo n.º 1
0
        public IActionResult DownForm(string key, string orderBy)
        {
            var model = new DownUrlModel();

            if (!string.IsNullOrEmpty(key))
            {
                var item = FastRead.Query <ApiGatewayDownParam>(a => a.Key.ToLower() == key.ToLower() && a.OrderBy == orderBy.ToInt(1), null, App.DbKey.Api).ToItem <ApiGatewayDownParam>();

                model.Name          = item.Name;
                model.IsBody        = item.IsBody;
                model.IsDecode      = item.IsDecode;
                model.IsResult      = item.IsResult;
                model.Key           = item.Key;
                model.Method        = item.Method;
                model.Name          = item.Name;
                model.Protocol      = item.Protocol;
                model.SoapMethod    = item.SoapMethod;
                model.SoapParamName = item.SoapParamName;
                model.SourceParam   = item.SourceParam;
                model.Url           = item.Url;
                model.WaitHour      = item.WaitHour;

                if (model.Key == null)
                {
                    model.IsResult = 1;
                    model.IsDecode = 1;
                    model.IsBody   = 0;
                }
            }

            return(PartialView("OptionLeaf", model));
        }
Ejemplo n.º 2
0
        public IActionResult DownUrlDel(DownUrlModel item)
        {
            using (var db = new DataContext(App.DbKey.Api))
            {
                var isSuccess = db.Delete <ApiGatewayDownParam>(a => a.Key == item.Key && a.OrderBy == item.OrderBy).writeReturn.IsSuccess;

                if (isSuccess)
                {
                    return(Json(new { success = isSuccess, msg = "删除成功" }));
                }
                else
                {
                    return(Json(new { success = isSuccess, msg = "删除失败" }));
                }
            }
        }
Ejemplo n.º 3
0
        public IActionResult DownUrlOption(DownUrlModel item)
        {
            using (var db = new DataContext(App.DbKey.Api))
            {
                var success = true;
                var model   = new ApiGatewayDownParam();
                model.Key           = item.Key;
                model.IsBody        = (int)item.IsBody;
                model.IsDecode      = (int)item.IsDecode;
                model.IsResult      = (int)item.IsResult;
                model.Method        = item.Method;
                model.Name          = item.Name;
                model.OrderBy       = item.OrderBy;
                model.Protocol      = item.Protocol;
                model.SoapMethod    = item.SoapMethod;
                model.SoapParamName = item.SoapParamName;
                model.SourceParam   = item.SourceParam;
                model.Url           = item.Url;
                model.WaitHour      = item.WaitHour;

                if (FastRead.Query <ApiGatewayDownParam>(a => a.Key.ToLower() == item.Key.ToLower() && a.OrderBy == item.OrderBy).ToCount(db) > 0)
                {
                    success = db.Update <ApiGatewayDownParam>(model, a => a.Key.ToLower() == item.Key.ToLower() && a.OrderBy == item.OrderBy).writeReturn.IsSuccess;
                }
                else
                {
                    success = db.Add(model).writeReturn.IsSuccess;
                }

                if (success)
                {
                    return(Json(new { success = true, msg = "操作成功" }));
                }
                else
                {
                    return(Json(new { success = false, msg = "操作失败" }));
                }
            }
        }