Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history


Conflicts:
	CodeProse.Shifter/partials/topnav.cshtml
  • Loading branch information
hawkeye312 committed Feb 8, 2012
2 parents b1e0657 + 6037220 commit 81e50e7
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
1 change: 1 addition & 0 deletions CodeProse.Shifter/CodeProse.Shifter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<None Include="layouts\base.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="partials\news-feed.cshtml" />
<None Include="partials\topnav.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
Expand Down
2 changes: 1 addition & 1 deletion CodeProse.Shifter/data/QueryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static User GetUserById(this IDbConnection connection, Guid identifier)
return connection.Query<User>("SELECT * FROM Users WHERE Id = @Id LIMIT 1", new { Id = identifier.ToString() }).First();
}

public static void AddUser(this IDatabase database, User newUser)
public static void AddNewUser(this IDatabase database, User newUser)
{
database.Connection.Execute(
"INSERT INTO Users VALUES (@Id, @UserName, @Password, @FirstName, @LastName, @Email)", newUser);
Expand Down
17 changes: 16 additions & 1 deletion CodeProse.Shifter/modules/MembersDataModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CodeProse.Shifter.domain;
using Nancy;
using Nancy.ModelBinding;
using System.Linq;

namespace CodeProse.Shifter.modules
{
Expand All @@ -12,7 +13,7 @@ public MembersDataModule(IDatabase database) : base("/members")
Post["/"] = x =>
{
var newMember = this.Bind<User>();
database.AddUser(newMember);
database.AddNewUser(newMember);
return HttpStatusCode.Accepted;
};

Expand All @@ -21,6 +22,20 @@ public MembersDataModule(IDatabase database) : base("/members")
var members = database.ListAllUsers();
return Response.AsJson(members);
};

Get[@"/(?<firstname>[\w]{1,20})(?<dash>[\-]{1})(?<lastname>[\w]{1,20})"] = x =>
{
var member =
database.ListAllUsers().Where(
m => m.FirstName == x.firstname && m.LastName == x.lastname).FirstOrDefault();
if (member != null)
{
return Response.AsJson(member);
}
return HttpStatusCode.NotFound;
};
}
}
}
7 changes: 7 additions & 0 deletions CodeProse.Shifter/partials/news-feed.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div>
<ul id="news-feed">
<li>Raul wants to give up his Feb 15 9am-12pm shift</li>
<li>Ryan wants to trade for his Feb 12 2pm-5pm shift</li>
<li>Sam picked up the Feb 14 9am-12pm shift from Raul (is this necessary?)</li>
</ul>
</div>
10 changes: 6 additions & 4 deletions CodeProse.Shifter/partials/topnav.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div id="topnav" class="ui-widget-header">
<a href="default">Home</a> <a href="view-calendar">View</a> <a href="assign-shifts">
Manage</a>
<div id="user">
@Model.UserName</div>
<a href="@Url.Content("~/index")">Home</a>
<a href="@Url.Content("~/wireframes/view-calendar")">Calendar</a>
<a href="@Url.Content("~/wireframes/manage-shifts")">Shifts</a>
<a href="@Url.Content("~/wireframes/manage-members")">Members</a>
<a href="@Url.Content("~/wireframes/assign-shifts")">Schedule</a>
<div id="user">@Model.UserName</div>
</div>
7 changes: 1 addition & 6 deletions CodeProse.Shifter/views/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
}

<h1>@Model.Introduction</h1>
<ul>
@foreach (var wireframe in Model.WireframePages)
{
<li><a href="@wireframe">@wireframe</a></li>
}
</ul>
@Html.Partial("partials/news-feed.cshtml")

@section Title {
<title>Welcome to Shifter!</title>
Expand Down

0 comments on commit 81e50e7

Please sign in to comment.