예제 #1
0
        public ActionResult EditItem(int id)
        {
            if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageMenus))
            {
                return(AccessDeniedView());
            }

            var item = _menuStorage.GetMenuItemById(id);

            if (item == null)
            {
                return(HttpNotFound());
            }

            var model = MiniMapper.Map <MenuItemRecord, MenuItemRecordModel>(item);

            model.ParentItemId    = item.ParentItemId == 0 ? (int?)null : item.ParentItemId;
            model.PermissionNames = item.PermissionNames.SplitSafe(",");

            PrepareModel(model, item);
            AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Title            = item.GetLocalized(x => x.Title, languageId, false, false);
                locale.ShortDescription = item.GetLocalized(x => x.ShortDescription, languageId, false, false);
            });

            return(View(model));
        }