Convert to Blazor #6

Merged
danieljsummers merged 7 commits from blazor into main 2020-12-19 02:46:28 +00:00
3 changed files with 13 additions and 4 deletions
Showing only changes of commit c5e99d9d8d - Show all commits

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
.fake
src/**/bin
src/**/obj
src/**/appsettings.*.json
src/**/appsettings.*.json
src/.vs

View File

@ -20,8 +20,7 @@ namespace JobsJobsJobs.Server.Data
/// <returns>A populated citizen</returns>
private static Citizen ToCitizen(NpgsqlDataReader rdr) =>
new Citizen(CitizenId.Parse(rdr.GetString("id")), rdr.GetString("na_user"), rdr.GetString("display_name"),
rdr.GetString("profile_url"), new Milliseconds(rdr.GetInt64("joined_on")),
new Milliseconds(rdr.GetInt64("last_seen_on")));
rdr.GetString("profile_url"), rdr.GetMilliseconds("joined_on"), rdr.GetMilliseconds("last_seen_on"));
/// <summary>
/// Retrieve a citizen by their No Agenda Social user name

View File

@ -1,4 +1,5 @@
using Npgsql;
using JobsJobsJobs.Shared;
using Npgsql;
using System;
using System.Collections.Generic;
using System.Linq;
@ -24,5 +25,13 @@ namespace JobsJobsJobs.Server.Data
/// <param name="name">The name of the field to be retrieved as a 64-bit integer</param>
/// <returns>The specified field as a 64-bit integer</returns>
public static long GetInt64(this NpgsqlDataReader rdr, string name) => rdr.GetInt64(rdr.GetOrdinal(name));
/// <summary>
/// Get milliseconds by its name
/// </summary>
/// <param name="name">The name of the field to be retrieved as milliseconds</param>
/// <returns>The specified field as milliseconds</returns>
public static Milliseconds GetMilliseconds(this NpgsqlDataReader rdr, string name) =>
new Milliseconds(rdr.GetInt64(name));
}
}