Changed the LastLogin property of the User model to allow null values, explcitly change the Entity User context to create a User table, and resolved bug that caused build issues in the SongController API class. The bug was caused by forgetting to change the type of the method after switching it from ActionResult to IActionResult. #40

This commit is contained in:
amazing-username
2019-05-11 12:43:54 -04:00
parent a3c74b50bc
commit c0ac3cdd30
3 changed files with 18 additions and 13 deletions
+15 -10
View File
@@ -10,18 +10,23 @@ using Icarus.Models;
namespace Icarus.Models.Context
{
public class UserContext : DbContext
{
public DbSet<User> Users { get; set; }
public class UserContext : DbContext
{
public DbSet<User> Users { get; set; }
public UserContext(DbContextOptions<UserContext> options)
: base(options)
{ }
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>();
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.ToTable("User");
modelBuilder.Entity<User>()
.Property(u => u.LastLogin).IsRequired(false);
modelBuilder.Entity<User>()
.Property(u => u.DateCreated).HasDefaultValue(DateTime.Now);
}
}
}
+1 -1
View File
@@ -27,6 +27,6 @@ namespace Icarus.Models
[JsonProperty("date_created")]
public DateTime DateCreated { get; set; }
[JsonProperty("last_login")]
public DateTime LastLogin { get; set; }
public DateTime? LastLogin { get; set; }
}
}