コード例 #1
0
        public JsonResult EditTreeMenuDetail(SysBest_MenuAddress entity)
        {
            var model = new ActionResultModel <string>();

            model.isSuccess    = _db.Update <SysBest_MenuAddress>(entity);
            model.responseInfo = model.isSuccess.IIF("编辑菜单详情成功!", "编辑菜单详情失败!");
            return(Json(model));
        }
コード例 #2
0
        public JsonResult AddTreeMenuDetail(SysBest_MenuAddress entity)
        {
            entity.CreateTime = DateTime.Now;
            entity.Founder    = "聪哥";
            var model = new ActionResultModel <string>();

            _db.Insert(entity);
            model.isSuccess    = true;
            model.responseInfo = model.isSuccess.IIF("新增菜单详情成功!", "新增菜单详情失败!");
            return(Json(model));
        }
コード例 #3
0
        public void Excute(int menuAddressId, int languageId, string uiEngineDir)
        {
            _uiEngineDir = uiEngineDir;
            var data = _db.Queryable <SysBest_MenuAddress>().FirstOrDefault(it => it.Id == menuAddressId);

            _data       = data;
            _languageId = languageId;
            string areaBoxDir           = FileSugar.MergeUrl(_solutionDir, "Areas", data.AreaName);
            string areaDir              = FileSugar.MergeUrl(_solutionDir, "Areas", data.AreaName);
            string viewsDir             = FileSugar.MergeUrl(areaDir, "Views");
            string areaRegistrationPath = FileSugar.MergeUrl(areaDir, "{0}AreaRegistration.cs".ToFormat(data.AreaName));
            string controllerDir        = FileSugar.MergeUrl(areaDir, "Controllers", data.ControllerName + "App");
            string controllerDomainDir  = FileSugar.MergeUrl(areaDir, "Controllers", data.ControllerName + "App", "Domain");
            string controllerDomainPath = FileSugar.MergeUrl(areaDir, "Controllers", data.ControllerName + "App", "Domain", data.ControllerName + "Domain.cs");
            string configPath           = FileSugar.MergeUrl(viewsDir, "Web.config");
            string viewPath             = FileSugar.MergeUrl(viewsDir, _data.ControllerName, _data.ActionName + ".cshtml");

            var lan = _db.Queryable <SysBest_Language>().FirstOrDefault(it => it.Id == languageId).Suffix;

            if (lan.IsValuable() && lan != "zh")
            {
                viewPath = FileSugar.MergeUrl(viewsDir, _data.ControllerName, _data.ActionName + $"_{lan}.cshtml");
            }
            string controllerPath = FileSugar.MergeUrl(controllerDir, data.ControllerName + "Controller.cs");
            string path           = _solutionDir + @"\" + _projectName + ".csproj";

            try
            {
                XDocument doc = XDocument.Load(path);
                BuildArea(areaDir, viewsDir, controllerDomainDir, areaRegistrationPath, configPath, doc);
                BuildController(controllerDir, controllerPath, controllerDomainPath, doc);
                BuildView(viewPath, doc);
                BuildDatabaseTableTable();
                doc.Save(path);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }