Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/ScavengerHunt/v15/sqlite3/storage.ide
Binary file not shown.
1,038 changes: 1,038 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion ScavengerHunt.Web/Content/Site.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ input[type="checkbox"].input-validation-error {

.bg-success, .bg-warning {
padding: 15px;
}
}

table span p {
color: #191919;
}
Binary file added ScavengerHunt.Web/Content/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion ScavengerHunt.Web/Content/bootstrap.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ScavengerHunt.Web/Content/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ScavengerHunt.Web/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser() { UserName = model.UserName };
var user = new ApplicationUser() { UserName = model.UserName, Email = model.Email };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
Expand Down
22 changes: 17 additions & 5 deletions ScavengerHunt.Web/Controllers/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@ public class BaseController : Controller
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);

Language = Request.UserLanguages == null ? "en" : Request.UserLanguages[0];

if (Request.Cookies["culture"] == null)
{
//create cookie if it doesn't exist
Response.Cookies["culture"].Value = "fr";
}

//eat the cookie
Language = Request.Cookies["culture"].Value.ToString();

if (String.IsNullOrEmpty(Language))
{
//set to english if cookie was not created
Language = "fr";
}
ViewBag.language = Language;

Thread.CurrentThread.CurrentCulture = new CultureInfo(Language);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(Language);
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(Language);
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(Language);

Settings = StrongSettings.GetSettings(db.Settings.ToList());
ViewBag.settings = Settings;
Expand Down
2 changes: 2 additions & 0 deletions ScavengerHunt.Web/Controllers/TeamStuntController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public ActionResult Index()
var stunts =
db.TeamStunts.Where(x => x.Team.Id == user.Team.Id && x.Stunt.Published)
.OrderByDescending(x => x.Status == TeamStuntStatusEnum.Pending)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.Incomplete)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.WorkInProgress)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.NotStarted)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.Abandon);
Expand Down Expand Up @@ -129,6 +130,7 @@ public ActionResult Summary()
var stunts =
db.TeamStunts.Where(x => x.Stunt.Published)
.OrderByDescending(x => x.Status == TeamStuntStatusEnum.Pending)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.Incomplete)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.WorkInProgress)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.NotStarted)
.ThenByDescending(x => x.Status == TeamStuntStatusEnum.Abandon);
Expand Down
14 changes: 14 additions & 0 deletions ScavengerHunt.Web/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;

namespace ScavengerHunt.Web
{
public static class Extensions
{
public static T FindOrDefault<T>(this List<T> list, Predicate<T> predicate, T defaultT)
{
int index = list.FindIndex(predicate);
return (index != -1) ? list[index] : defaultT;
}
}
}
29 changes: 29 additions & 0 deletions ScavengerHunt.Web/Migrations/201708310154222_Initial.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

184 changes: 184 additions & 0 deletions ScavengerHunt.Web/Migrations/201708310154222_Initial.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
namespace ScavengerHunt.Web.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class Initial : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Roles",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Name = c.String(nullable: false),
})
.PrimaryKey(t => t.Id);

CreateTable(
"dbo.Settings",
c => new
{
Key = c.String(nullable: false, maxLength: 128),
Value = c.String(),
Description = c.String(),
})
.PrimaryKey(t => t.Key);

CreateTable(
"dbo.Stunts",
c => new
{
Id = c.Int(nullable: false, identity: true),
MaxScore = c.Int(nullable: false),
Keyword = c.String(),
Type = c.Int(nullable: false),
Published = c.Boolean(nullable: false),
JudgeNotes = c.String(),
Collapsible = c.Boolean(nullable: false),
Title = c.String(),
Description = c.String(),
})
.PrimaryKey(t => t.Id);

CreateTable(
"dbo.TeamStunts",
c => new
{
Id = c.Int(nullable: false, identity: true),
Score = c.Int(nullable: false),
DateUpdated = c.DateTime(nullable: false),
Submission = c.String(),
TeamNotes = c.String(),
JudgeFeedback = c.String(),
JudgeNotes = c.String(),
Status = c.Int(nullable: false),
Team_Id = c.Int(nullable: false),
Stunt_Id = c.Int(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Teams", t => t.Team_Id, cascadeDelete: true)
.ForeignKey("dbo.Stunts", t => t.Stunt_Id, cascadeDelete: true)
.Index(t => t.Team_Id)
.Index(t => t.Stunt_Id);

CreateTable(
"dbo.Teams",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(),
Token = c.String(),
Tagline = c.String(),
Url = c.String(),
BonusPoints = c.Int(nullable: false),
ContactUser_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Users", t => t.ContactUser_Id)
.Index(t => t.ContactUser_Id);

CreateTable(
"dbo.Users",
c => new
{
UserId = c.String(nullable: false, maxLength: 128),
UserName = c.String(nullable: false),
PasswordHash = c.String(),
SecurityStamp = c.String(),
Email = c.String(),
Discriminator = c.String(nullable: false, maxLength: 128),
Team_Id = c.Int(),
})
.PrimaryKey(t => t.UserId)
.ForeignKey("dbo.Teams", t => t.Team_Id)
.Index(t => t.Team_Id);

CreateTable(
"dbo.UserClaims",
c => new
{
Id = c.Int(nullable: false, identity: true),
ClaimType = c.String(),
ClaimValue = c.String(),
User_Id = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Users", t => t.User_Id, cascadeDelete: true)
.Index(t => t.User_Id);

CreateTable(
"dbo.UserLogins",
c => new
{
UserId = c.String(nullable: false, maxLength: 128),
LoginProvider = c.String(nullable: false, maxLength: 128),
ProviderKey = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.UserId, t.LoginProvider, t.ProviderKey })
.ForeignKey("dbo.Users", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);

CreateTable(
"dbo.UserRoles",
c => new
{
UserId = c.String(nullable: false, maxLength: 128),
RoleId = c.String(nullable: false, maxLength: 128),
})
.PrimaryKey(t => new { t.UserId, t.RoleId })
.ForeignKey("dbo.Roles", t => t.RoleId, cascadeDelete: true)
.ForeignKey("dbo.Users", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId)
.Index(t => t.RoleId);

CreateTable(
"dbo.StuntTranslations",
c => new
{
Id = c.Int(nullable: false, identity: true),
Language = c.String(),
Title = c.String(),
Description = c.String(),
Stunt_Id = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Stunts", t => t.Stunt_Id, cascadeDelete: true)
.Index(t => t.Stunt_Id);

}

public override void Down()
{
DropForeignKey("dbo.StuntTranslations", "Stunt_Id", "dbo.Stunts");
DropForeignKey("dbo.TeamStunts", "Stunt_Id", "dbo.Stunts");
DropForeignKey("dbo.TeamStunts", "Team_Id", "dbo.Teams");
DropForeignKey("dbo.Users", "Team_Id", "dbo.Teams");
DropForeignKey("dbo.Teams", "ContactUser_Id", "dbo.Users");
DropForeignKey("dbo.UserClaims", "User_Id", "dbo.Users");
DropForeignKey("dbo.UserRoles", "UserId", "dbo.Users");
DropForeignKey("dbo.UserRoles", "RoleId", "dbo.Roles");
DropForeignKey("dbo.UserLogins", "UserId", "dbo.Users");
DropIndex("dbo.StuntTranslations", new[] { "Stunt_Id" });
DropIndex("dbo.UserRoles", new[] { "RoleId" });
DropIndex("dbo.UserRoles", new[] { "UserId" });
DropIndex("dbo.UserLogins", new[] { "UserId" });
DropIndex("dbo.UserClaims", new[] { "User_Id" });
DropIndex("dbo.Users", new[] { "Team_Id" });
DropIndex("dbo.Teams", new[] { "ContactUser_Id" });
DropIndex("dbo.TeamStunts", new[] { "Stunt_Id" });
DropIndex("dbo.TeamStunts", new[] { "Team_Id" });
DropTable("dbo.StuntTranslations");
DropTable("dbo.UserRoles");
DropTable("dbo.UserLogins");
DropTable("dbo.UserClaims");
DropTable("dbo.Users");
DropTable("dbo.Teams");
DropTable("dbo.TeamStunts");
DropTable("dbo.Stunts");
DropTable("dbo.Settings");
DropTable("dbo.Roles");
}
}
}
Loading