Пример #1
0
        public ViewModels.DictaatPageSummary Post(string dictaatName, [FromBody] ViewModels.DictaatPageForm form)
        {
            var MenuItem = new ViewModels.MenuItem()
            {
                Name = form.Page.Name,
                Url  = form.Page.Name
            };

            var result = _pageRepo.CreateDictaatPage(dictaatName, form.Page);

            _menuRepo.AddMenuItem(dictaatName, form.SubMenu, MenuItem);
            return(result);
        }
Пример #2
0
        public async Task <List <ViewModels.MenuItem> > Post(string dictaatName, [FromBody] ViewModels.DictaatPageForm form)
        {
            if (!AuthorizeResource(dictaatName))
            {
                return(null);
            }

            if (!ModelState.IsValid)
            {
                HttpContext.Response.StatusCode = 400;
                return(null);
            }

            var MenuItem = new ViewModels.MenuItem()
            {
                Name = form.Page.Name,
                Url  = form.Page.Url
            };

            var result = _pageRepo.CreateDictaatPage(dictaatName, form.Page, form.TemplateName);
            var menu   = _menuRepo.AddMenuItem(dictaatName, form.SubMenu, MenuItem);

            return(menu);
        }