Skip to content

Instantly share code, notes, and snippets.

Talking Dotnet talkingdotnet

View GitHub Profile
View Blazor_Index.html
<!DOCTYPE html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<base href="/" />
<script src="" type="text/javascript"></script>
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
View fetchdata.component.dropdown.html
<label>Summary: </label>
<select (change)="filterForeCasts($">
<option value="0">--All--</option>
<option *ngFor="let summary of summaries" value={{summary}}>
View fetchdata.component.dropdown.ts
import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
selector: 'fetchdata',
templateUrl: './fetchdata.component.html'
export class FetchDataComponent {
public forecasts: WeatherForecast[];
public cacheForecasts: WeatherForecast[];
View FetchDataGetSummaries.cs
private static string[] Summaries = new[]
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
public string[] GetSummaries()
return Summaries;
View ToDoWithoutJS.cshtml
@page "/anothertodo"
@using ASPNETBlazorCRUDApp.Shared
@inject HttpClient Http
<h1>ToDo List</h1>
<div class="row">
<div class="col-sm-1">
View ToDoListController.cs
public class ToDoListController : Controller
private readonly ToDoListContext _context;
public ToDoListController(ToDoListContext context)
_context = context;
View ToDo.html
@page "/todo"
@using ASPNETBlazorCRUDApp.Shared
@using Microsoft.AspNetCore.Blazor.Browser.Interop
@inject HttpClient Http
<h1>ToDo List</h1>
<div class="row">
<div class="col-sm-1">
View NavMenu.html
<NavLink href="/todo">
<span class='glyphicon glyphicon-list-alt'></span> To Do
View BlazorStartupConfigureMethod.cs
public void ConfigureServices(IServiceCollection services)
// Use Entity Framework in-memory provider for this sample
services.AddDbContext<ToDoListContext>(options => options.UseInMemoryDatabase("ToDoList"));
services.AddMvc().AddJsonOptions(options =>
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
View ToDoListContext.cs
public class ToDoListContext : DbContext
public ToDoListContext(DbContextOptions<ToDoListContext> options) : base(options) { }
public DbSet<ToDoList> ToDoLists { get; set; }
You can’t perform that action at this time.