public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller)
        {
            if (Controllers.ContainsKey(controller.Name))
            {
                throw new Exception($"There is already a controller with name: {controller.Name} in module: {Name}");
            }

            return(Controllers[controller.Name] = controller);
        }
        public ControllerApiDescriptionModel GetOrAddController(string name)
        {
            ControllerApiDescriptionModel obj;

            if (Controllers.TryGetValue(name, out obj))
            {
                return(obj);
            }
            return(Controllers[name] = new ControllerApiDescriptionModel(name));
        }
Пример #3
0
        public ControllerApiDescriptionModel CreateSubModel(string[] actions)
        {
            var subModel = new ControllerApiDescriptionModel(Name);

            foreach (var action in Actions.Values)
            {
                if (actions == null || actions.Contains(action.Name))
                {
                    subModel.AddAction(action);
                }
            }

            return(subModel);
        }