Skip to content

BlazingApple/Survey

Repository files navigation

BlazingApple.Survey 🍎

🔥 A totally copacetic, easy-to-use front-end Blazor Survey package. This front-end Razor Class Library is intended to be used by Blazor WASM projects, and targets .NET 5.

About BlazingApples

BlazingApples is an open-source set of packages that aims to speed application development for Blazor WebAssembly organizations.

⚡ Check out the demo site here, or this blog post on how the components work!

👏 Special thanks to ADefWebServer for creating the BlazorSimpleSurvey demo application which this is based off of.

Demo 📹

Demo of BlazingApple.Survey

Installation 🔧

1. Get the required dependencies.

  1. On Client Project, right click and get to the NuGet Package Manager ("Manage NuGetPackages").
  2. Install BlazingApple.Survey

Survey Administration

  1. Add the following to Program.cs's Main:
			builder.Services.AddScoped<DialogService>();
			builder.Services.AddScoped<TooltipService>();
			builder.Services.AddScoped<NotificationService>();
			builder.Services.AddScoped<BlazingApple.SurveyService>();
  1. In your index.html file, add the required Radzen style and script:
    <link rel="stylesheet" href="_content/Radzen.Blazor/css/default-base.css"> <!-- this adds a lot of styles we don't want -->
    <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>

2. Set up your server's API controller to receive the requests.

It is recommended to do this with EntityFrameworkCore to create the tables in my database and receive and process the request. This portion of the setup shows how to do this.

  1. In your Server project, open ApplicationDbContext, add the following tables:
		using BlazingApples.Shared;
		...
    public DbSet<Survey> Surveys { get; set; }
		public DbSet<SurveyAnswer> SurveyAnswers { get; set; }
		public DbSet<SurveyItem> SurveyItems { get; set; }
		public DbSet<SurveyItemOption> SurveyItemOptions { get; set; }
  1. Create a SurveysController.cs in the Controllers directory, use this controller as the controller.

  2. In the Package Manager Console, enter the following commands:

Survey Administration

``` Add-Migration AddSurveyData Update-Database ``` Now you should be all set to use the components.

Usage 💪

Once the (admittedly rather involved) setup is complete, using the components is straightforward:

  1. In a component, add the <DisplaySurvey></DisplaySurvey> component to show surveys to a user. If no survey is provided, this component will download all the active surveys from the server and give the user options to take them.
  2. Use the <SurveyAdmin></SurveyAdmin> component in a page in which you'd like to enable users to create or modify surveys.
  3. Step 3

Credits 💮

Authors 📝

  1. Taylor White

License 📜

License: GPL v2

Home Page 📷

Survey Administration

Taking Surveys 📷

Taking a Survey

Monitoring Responses 📷

Survey Responses