Ejemplo n.º 1
0
        public UpdateMenuViewModel UpdateViewModel(UpdateMenuViewModel viewModel)
        {
            viewModel.RoleGroupOptions = _roleService.GetRoleGroups(new Services.Requests.RoleGroup.GetRoleGroupsRequest {
                Take = -1,
                SortingDictionary = new Dictionary<string, SortOrder> { { "Name", SortOrder.Ascending } }
            }).RoleGroups.Select(x => new SelectListItem
                {
                    Text = x.Name,
                    Value = x.Id.ToString()
                }).ToList();

            List<SelectListItem> menuList = _menuService.GetMenus(
                new Services.Requests.Menu.GetMenusRequest { Skip = 0, Take = 0 }).Menus.Select(x => new SelectListItem
                {
                    Text = x.Name,
                    Value = x.Id.ToString()
                }).ToList();
            //menuList.Insert(0, new SelectListItem { Text = "This is Root", Value = "0" });
            viewModel.MenuOptions = menuList;

            return viewModel;
        }
Ejemplo n.º 2
0
        public ActionResult Update(UpdateMenuViewModel viewModel)
        {
            var request = viewModel.MapTo<UpdateMenuRequest>();
            var response = _menuService.Update(request);
            TempData["IsSuccess"] = response.IsSuccess;
            TempData["Message"] = response.Message;
            if (response.IsSuccess)
            {
                return RedirectToAction("Index");
            }

            return View("Update", viewModel);
        }