Пример #1
0
        public IHttpActionResult Default([FromBody] DefaultArgs args)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var value = service.Default(args.Name);
                return(Ok(value));
            }
            catch (NotSupportedException)
            {
                return(BadRequest());
            }
            catch (UnauthorizedAccessException)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
            catch (DuplicateKeyException)
            {
                ModelState.AddModelError(nameof(InfusionGlobalPreference.Name), nameof(DuplicateKeyException));
                return(BadRequest(ModelState));
            }
        }
Пример #2
0
        public ControllerScaffolder(ScaffolderArgs args, string controllerTypeArgument)
        {
            var defaultNamespace = args.ParentFolder.Combine("file.cs");

            DefaultArgs.Add(
                new CommandLineArg("--controllerNamespace", args.Project.GetDefaultNamespace(defaultNamespace))
                );

            if (controllerTypeArgument != null)
            {
                DefaultArgs.Add(new CommandLineArg(controllerTypeArgument));
            }
        }
Пример #3
0
 public EmptyApiControllerScaffolder(ScaffolderArgs args) : base(args)
 {
     DefaultArgs.Add(new CommandLineArg("--restWithNoViews"));
 }
        public RazorPageScaffolderBase(ScaffolderArgs args)
        {
            var defaultNamespace = args.ParentFolder.Combine("file.cs");

            DefaultArgs.Add(new CommandLineArg("--namespaceName", args.Project.GetDefaultNamespace(defaultNamespace)));
        }
Пример #5
0
 public MvcControllerWithActionsScaffolder(ScaffolderArgs args) : base(args)
 {
     DefaultArgs.Add(new CommandLineArg("--readWriteActions"));
 }