コード例 #1
0
        public async Task <JsonResult> Insert(Envs model)
        {
            var result = new BaseResult();
            var list   = await _envService.GetList();

            var nameList = list.Where(s => string.Equals(s.Name.Trim(), model.Name, StringComparison.OrdinalIgnoreCase));

            if (nameList != null && nameList.Count() > 0)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = "该环境名称已经存在";
            }
            else
            {
                await _envService.Insert(model);

                result.IsSuccess = await _permissionService.BatchInsertByAfterEnv(model.Name);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }