BlazorBlog created. I don't know where I was at...

This commit is contained in:
Tracy Pearson
2021-12-10 00:25:20 -05:00
parent 38cfa06533
commit ce5aee2679
33 changed files with 1382 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlazorBlog.Data
{
public class BlogPost
{
public int Id { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public DateTime Posted { get; set; }
public string Post { get; set; }
public string PostSummary
{
get
{
if (Post.Length > 50)
return Post.Substring(0, 50);
return Post;
}
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
namespace BlazorBlog.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Linq;
using System.Threading.Tasks;
namespace BlazorBlog.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
var rng = new Random();
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
}).ToArray());
}
}
}