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)); } }
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)); } }
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))); }
public MvcControllerWithActionsScaffolder(ScaffolderArgs args) : base(args) { DefaultArgs.Add(new CommandLineArg("--readWriteActions")); }