From 63e1ac65e5351ba4e9385d3ec4abd1d889f016e4 Mon Sep 17 00:00:00 2001 From: Lambert Wang Date: Wed, 26 Sep 2018 20:08:32 -0700 Subject: [PATCH 1/2] Added contact and information in footer --- Data/DataModel/Event.cs | 3 +++ ServerCore/Pages/Events/Create.cshtml | 5 +++++ ServerCore/Pages/Events/Details.cshtml | 6 ++++++ ServerCore/Pages/_Layout.cshtml | 8 +++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Data/DataModel/Event.cs b/Data/DataModel/Event.cs index 8dbfcd70..56bb8f16 100644 --- a/Data/DataModel/Event.cs +++ b/Data/DataModel/Event.cs @@ -16,6 +16,9 @@ public class Event [DataType(DataType.Url)] public string UrlString { get; set; } + [DataType(DataType.EmailAddress)] + public string ContactEmail { get; set; } + [NotMapped] public Uri URL { diff --git a/ServerCore/Pages/Events/Create.cshtml b/ServerCore/Pages/Events/Create.cshtml index fe2c2ceb..5cff6a33 100644 --- a/ServerCore/Pages/Events/Create.cshtml +++ b/ServerCore/Pages/Events/Create.cshtml @@ -23,6 +23,11 @@ +
+ + + +
diff --git a/ServerCore/Pages/Events/Details.cshtml b/ServerCore/Pages/Events/Details.cshtml index 46d53ba8..4230b5b2 100644 --- a/ServerCore/Pages/Events/Details.cshtml +++ b/ServerCore/Pages/Events/Details.cshtml @@ -23,6 +23,12 @@
@Html.DisplayFor(model => model.Event.UrlString)
+
+ @Html.DisplayNameFor(model => model.Event.ContactEmail) +
+
+ @Html.DisplayFor(model => model.Event.ContactEmail) +
@Html.DisplayNameFor(model => model.Event.MaxNumberOfTeams)
diff --git a/ServerCore/Pages/_Layout.cshtml b/ServerCore/Pages/_Layout.cshtml index 8f1ba2aa..93a337dd 100644 --- a/ServerCore/Pages/_Layout.cshtml +++ b/ServerCore/Pages/_Layout.cshtml @@ -127,7 +127,13 @@ @RenderBody()
From 9865bdf6eaea08c8c01d22f59b539892c73b2754 Mon Sep 17 00:00:00 2001 From: Lambert Wang Date: Wed, 26 Sep 2018 20:10:19 -0700 Subject: [PATCH 2/2] Added migration --- ...927030906_AddEventContactEmail.Designer.cs | 625 ++++++++++++++++++ .../20180927030906_AddEventContactEmail.cs | 22 + 2 files changed, 647 insertions(+) create mode 100644 Data/Migrations/20180927030906_AddEventContactEmail.Designer.cs create mode 100644 Data/Migrations/20180927030906_AddEventContactEmail.cs diff --git a/Data/Migrations/20180927030906_AddEventContactEmail.Designer.cs b/Data/Migrations/20180927030906_AddEventContactEmail.Designer.cs new file mode 100644 index 00000000..b4874225 --- /dev/null +++ b/Data/Migrations/20180927030906_AddEventContactEmail.Designer.cs @@ -0,0 +1,625 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ServerCore.Models; + +namespace Data.Migrations +{ + [DbContext(typeof(PuzzleServerContext))] + [Migration("20180927030906_AddEventContactEmail")] + partial class AddEventContactEmail + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("ServerCore.DataModel.ContentFile", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EventID"); + + b.Property("FileType"); + + b.Property("PuzzleID") + .IsRequired(); + + b.Property("ShortName") + .IsRequired(); + + b.Property("UrlString") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("PuzzleID"); + + b.HasIndex("EventID", "ShortName") + .IsUnique(); + + b.ToTable("ContentFiles"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Event", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AdminsID"); + + b.Property("AllowFeedback"); + + b.Property("AnswerSubmissionEnd"); + + b.Property("AnswersAvailableBegin"); + + b.Property("ContactEmail"); + + b.Property("EventBegin"); + + b.Property("IsInternEvent"); + + b.Property("MaxExternalsPerTeam"); + + b.Property("MaxNumberOfTeams"); + + b.Property("MaxTeamSize"); + + b.Property("Name"); + + b.Property("ShowFastestSolves"); + + b.Property("StandingsAvailableBegin"); + + b.Property("StandingsOverride"); + + b.Property("TeamDeleteEnd"); + + b.Property("TeamMembershipChangeEnd"); + + b.Property("TeamMiscDataChangeEnd"); + + b.Property("TeamNameChangeEnd"); + + b.Property("TeamRegistrationBegin"); + + b.Property("TeamRegistrationEnd"); + + b.Property("UrlString"); + + b.HasKey("ID"); + + b.HasIndex("AdminsID"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventAdmins", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Event.ID"); + + b.Property("User.ID"); + + b.HasKey("ID"); + + b.HasIndex("Event.ID"); + + b.HasIndex("User.ID"); + + b.ToTable("EventAdmins"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventAuthors", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Event.ID"); + + b.Property("User.ID"); + + b.HasKey("ID"); + + b.HasIndex("Event.ID") + .IsUnique() + .HasFilter("[Event.ID] IS NOT NULL"); + + b.HasIndex("User.ID"); + + b.ToTable("EventAuthors"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventOwners", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Event.ID"); + + b.Property("User.ID"); + + b.HasKey("ID"); + + b.HasIndex("Event.ID"); + + b.HasIndex("User.ID"); + + b.ToTable("EventOwners"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventTeams", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Event.ID"); + + b.Property("Teams.ID"); + + b.HasKey("ID"); + + b.HasIndex("Event.ID") + .IsUnique() + .HasFilter("[Event.ID] IS NOT NULL"); + + b.HasIndex("Teams.ID"); + + b.ToTable("EventTeams"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Feedback", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Difficulty"); + + b.Property("Fun"); + + b.Property("PuzzleID"); + + b.Property("SubmissionTime"); + + b.Property("SubmitterID"); + + b.Property("WrittenFeedback"); + + b.HasKey("ID"); + + b.HasIndex("PuzzleID"); + + b.HasIndex("SubmitterID"); + + b.ToTable("Feedback"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Invitation", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EmailAddress"); + + b.Property("Expiration"); + + b.Property("InvitationCode"); + + b.Property("InvitationType"); + + b.Property("TeamID"); + + b.HasKey("ID"); + + b.HasIndex("TeamID"); + + b.ToTable("Invitations"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Prerequisites", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("PrerequisiteID"); + + b.Property("PuzzleID"); + + b.HasKey("ID"); + + b.HasIndex("PrerequisiteID"); + + b.HasIndex("PuzzleID"); + + b.ToTable("Prerequisites"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Puzzle", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EventID"); + + b.Property("Group"); + + b.Property("IsFinalPuzzle"); + + b.Property("IsGloballyVisiblePrerequisite"); + + b.Property("IsMetaPuzzle"); + + b.Property("IsPuzzle"); + + b.Property("MinPrerequisiteCount"); + + b.Property("Name"); + + b.Property("OrderInGroup"); + + b.Property("SolveValue"); + + b.Property("Token"); + + b.HasKey("ID"); + + b.HasIndex("EventID"); + + b.ToTable("Puzzles"); + }); + + modelBuilder.Entity("ServerCore.DataModel.PuzzleAuthors", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Puzzle.ID"); + + b.Property("User.ID"); + + b.HasKey("ID"); + + b.HasIndex("Puzzle.ID"); + + b.HasIndex("User.ID"); + + b.ToTable("PuzzleAuthors"); + }); + + modelBuilder.Entity("ServerCore.DataModel.PuzzleStatePerTeam", b => + { + b.Property("PuzzleID"); + + b.Property("TeamID"); + + b.Property("Notes"); + + b.Property("Printed"); + + b.Property("SolvedTime"); + + b.Property("UnlockedTime"); + + b.HasKey("PuzzleID", "TeamID"); + + b.HasIndex("TeamID"); + + b.ToTable("PuzzleStatePerTeam"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Response", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("IsSolution"); + + b.Property("Note"); + + b.Property("PuzzleID"); + + b.Property("SubmittedText"); + + b.HasKey("ID"); + + b.HasIndex("PuzzleID"); + + b.ToTable("Responses"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Submission", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("PuzzleID"); + + b.Property("ResponseID"); + + b.Property("SubmissionText"); + + b.Property("SubmitterID"); + + b.Property("TeamID"); + + b.Property("TimeSubmitted"); + + b.HasKey("ID"); + + b.HasIndex("PuzzleID"); + + b.HasIndex("ResponseID"); + + b.HasIndex("SubmitterID"); + + b.HasIndex("TeamID"); + + b.ToTable("Submissions"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Team", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CustomRoom"); + + b.Property("EventID"); + + b.Property("Name"); + + b.Property("PrimaryContactEmail"); + + b.Property("PrimaryPhoneNumber"); + + b.Property("RoomID"); + + b.Property("SecondaryPhoneNumber"); + + b.HasKey("ID"); + + b.HasIndex("EventID"); + + b.ToTable("Teams"); + }); + + modelBuilder.Entity("ServerCore.DataModel.TeamMembers", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Team.ID"); + + b.Property("User.ID"); + + b.HasKey("ID"); + + b.HasIndex("Team.ID") + .IsUnique() + .HasFilter("[Team.ID] IS NOT NULL"); + + b.HasIndex("User.ID"); + + b.ToTable("TeamMembers"); + }); + + modelBuilder.Entity("ServerCore.DataModel.User", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EmailAddress"); + + b.Property("EmployeeAlias"); + + b.Property("Name"); + + b.Property("PhoneNumber"); + + b.Property("TShirtSize"); + + b.Property("VisibleToOthers"); + + b.HasKey("ID"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ServerCore.DataModel.ContentFile", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithMany() + .HasForeignKey("EventID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany("Contents") + .HasForeignKey("PuzzleID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ServerCore.DataModel.Event", b => + { + b.HasOne("ServerCore.DataModel.EventAdmins", "Admins") + .WithMany() + .HasForeignKey("AdminsID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventAdmins", b => + { + b.HasOne("ServerCore.DataModel.EventOwners", "Event") + .WithMany() + .HasForeignKey("Event.ID"); + + b.HasOne("ServerCore.DataModel.User", "Admin") + .WithMany() + .HasForeignKey("User.ID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventAuthors", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithOne("Authors") + .HasForeignKey("ServerCore.DataModel.EventAuthors", "Event.ID"); + + b.HasOne("ServerCore.DataModel.User", "Author") + .WithMany() + .HasForeignKey("User.ID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventOwners", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithMany() + .HasForeignKey("Event.ID"); + + b.HasOne("ServerCore.DataModel.User", "Owner") + .WithMany() + .HasForeignKey("User.ID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.EventTeams", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithOne("Teams") + .HasForeignKey("ServerCore.DataModel.EventTeams", "Event.ID"); + + b.HasOne("ServerCore.DataModel.Team", "Team") + .WithMany() + .HasForeignKey("Teams.ID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Feedback", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("PuzzleID"); + + b.HasOne("ServerCore.DataModel.User", "Submitter") + .WithMany() + .HasForeignKey("SubmitterID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Invitation", b => + { + b.HasOne("ServerCore.DataModel.Team") + .WithMany("Invitations") + .HasForeignKey("TeamID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Prerequisites", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Prerequisite") + .WithMany() + .HasForeignKey("PrerequisiteID"); + + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("PuzzleID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Puzzle", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithMany() + .HasForeignKey("EventID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.PuzzleAuthors", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("Puzzle.ID"); + + b.HasOne("ServerCore.DataModel.User", "Author") + .WithMany() + .HasForeignKey("User.ID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.PuzzleStatePerTeam", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("PuzzleID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ServerCore.DataModel.Team", "Team") + .WithMany() + .HasForeignKey("TeamID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ServerCore.DataModel.Response", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("PuzzleID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Submission", b => + { + b.HasOne("ServerCore.DataModel.Puzzle", "Puzzle") + .WithMany() + .HasForeignKey("PuzzleID"); + + b.HasOne("ServerCore.DataModel.Response", "Response") + .WithMany() + .HasForeignKey("ResponseID"); + + b.HasOne("ServerCore.DataModel.User", "Submitter") + .WithMany() + .HasForeignKey("SubmitterID"); + + b.HasOne("ServerCore.DataModel.Team", "Team") + .WithMany() + .HasForeignKey("TeamID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.Team", b => + { + b.HasOne("ServerCore.DataModel.Event", "Event") + .WithMany() + .HasForeignKey("EventID"); + }); + + modelBuilder.Entity("ServerCore.DataModel.TeamMembers", b => + { + b.HasOne("ServerCore.DataModel.Team", "Team") + .WithOne("Members") + .HasForeignKey("ServerCore.DataModel.TeamMembers", "Team.ID"); + + b.HasOne("ServerCore.DataModel.User", "Member") + .WithMany() + .HasForeignKey("User.ID"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20180927030906_AddEventContactEmail.cs b/Data/Migrations/20180927030906_AddEventContactEmail.cs new file mode 100644 index 00000000..4e878b3b --- /dev/null +++ b/Data/Migrations/20180927030906_AddEventContactEmail.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Data.Migrations +{ + public partial class AddEventContactEmail : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ContactEmail", + table: "Events", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ContactEmail", + table: "Events"); + } + } +}