Exemplo n.º 1
0
        public MenuMaster()
        {
            InitializeComponent();

            BindingContext = new MenuMasterViewModel();
            ListView       = MenuItemsListView;
        }
Exemplo n.º 2
0
 public MenuMaster()
 {
     InitializeComponent();
     lblUsuario.Text = Sistema.Sistema.usuario.name ?? "";
     BindingContext  = new MenuMasterViewModel();
     ListView        = MenuItemsListView;
 }
        public ActionResult Create(MenuMasterViewModel menuvm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (_iMenu.CheckMenuNameExists(menuvm.MenuName, menuvm.RoleId, menuvm.MenuCategoryId))
                    {
                        ModelState.AddModelError("", CommonMessages.MenuNameAlreadyExistsMessages);
                        menuvm.AllActiveRoles     = _role.GetAllActiveRoles();
                        menuvm.ListofMenuCategory = new List <SelectListItem>()
                        {
                            new SelectListItem()
                            {
                                Value = "",
                                Text  = "-----Select-----"
                            }
                        };
                        return(View(menuvm));
                    }

                    MenuMaster menuMaster = new MenuMaster()
                    {
                        UserId         = Convert.ToInt64(_sessionHandler.UserId),
                        MenuName       = menuvm.MenuName,
                        Status         = menuvm.Status,
                        ActionMethod   = menuvm.ActionMethod,
                        ControllerName = menuvm.ControllerName,
                        MenuId         = 0,
                        CategoryId     = menuvm.MenuCategoryId,
                        RoleId         = menuvm.RoleId,
                        CreateDate     = DateTime.Now
                    };

                    _iMenu.AddMenu(menuMaster);
                    TempData["MenuSuccessMessages"] = CommonMessages.MenuSuccessMessages;
                    return(RedirectToAction("Create"));
                }

                menuvm.AllActiveRoles     = _role.GetAllActiveRoles();
                menuvm.ListofMenuCategory = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                };
                return(View(menuvm));
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: MenuMasters/Create
        public ActionResult Create()
        {
            MenuMasterViewModel menuMasterViewModel = new MenuMasterViewModel()
            {
                AllActiveRoles     = _role.GetAllActiveRoles(),
                ListofMenuCategory = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "",
                        Text  = "-----Select-----"
                    }
                }
            };

            return(View(menuMasterViewModel));
        }
Exemplo n.º 5
0
 public MenuMasterView(User user)
 {
     InitializeComponent();
     this.ViewMovel      = new MenuMasterViewModel(user);
     this.BindingContext = this.ViewMovel;
 }
Exemplo n.º 6
0
 public void CriarMenu()
 {
     BindingContext = new MenuMasterViewModel();
     ListView       = MenuItemsListView;
 }