Пример #1
0
        async Task <ViewInfo> LoadViewKind(String pathInfo, RequestUrlKind kind)
        {
            var host = _baseController.Host;
            var rm   = await RequestModel.CreateFromUrl(host, false, kind, NormalizeUrl(pathInfo));

            var rw     = rm.GetCurrentAction();
            var pageId = $"el{Guid.NewGuid()}";
            var dmrw   = await _baseController.GetDataModelForView(rw, CreateParams());

            rw = dmrw.RequestView;
            var viewInfo = new ViewInfo()
            {
                PageId    = pageId,
                View      = host.MakeRelativePath(rw.Path, $"{rw.GetView()}.cshtml"),
                Path      = rw.Path,
                BaseUrl   = rw.ParentModel.BasePath,
                DataModel = dmrw.Model,
                Id        = rw.Id
            };

            var msi = new ModelScriptInfo()
            {
                DataModel = viewInfo.DataModel,
                RootId    = pageId,
                IsDialog  = rw.IsDialog,
                Template  = rw.template,
                Path      = rw.Path,
                BaseUrl   = rw.ParentModel.BasePath
            };

            viewInfo.Scripts = await _baseController.Scripter.GetModelScript(msi);

            return(viewInfo);
        }