Exemple #1
0
        public virtual ActionResult AddAction(string moduleName)
        {
            if (string.IsNullOrEmpty(moduleName))
            {
                return(RedirectToAction("Index"));
            }

            AddActionsToModuleViewModel model = new AddActionsToModuleViewModel();

            model.ModuleName = moduleName;
            model.GUID       = moduleRepo.FindByName(moduleName).Id.ToString();

            List <Business.Entities.Actions> availableActions = actionRepo.Find();
            List <Business.Entities.Actions> usedActions      = moduleRepo.GetActionsInModule(moduleName);

            //used action
            foreach (Business.Entities.Actions a in usedActions)
            {
                availableActions.RemoveAll(x => x.ActionName == a.ActionName);
            }

            model.AvailableActions = new SelectList(availableActions, "Id", "ActionName");
            model.AddedActions     = new SelectList(usedActions, "Id", "ActionName");

            return(View(model));
        }