diff options
| author | Michael <[email protected]> | 2017-05-07 09:19:55 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-07 09:19:55 -0400 |
| commit | 0ae47a126b1fb37ecbc80ecddd34a892fb6fd3b2 (patch) | |
| tree | 1daa7ef50bdc8fd340566b8731eb5d9805cc2fa4 | |
| parent | 0cdba811a67c0fa8f9a68c8efa9280ea0cf22801 (diff) | |
| download | project-unite-0ae47a126b1fb37ecbc80ecddd34a892fb6fd3b2.tar.gz project-unite-0ae47a126b1fb37ecbc80ecddd34a892fb6fd3b2.tar.bz2 project-unite-0ae47a126b1fb37ecbc80ecddd34a892fb6fd3b2.zip | |
groups (formerly legions) index
| -rw-r--r-- | Project-Unite/Controllers/GroupsController.cs | 19 | ||||
| -rw-r--r-- | Project-Unite/Models/Group.cs | 28 | ||||
| -rw-r--r-- | Project-Unite/Models/IdentityModels.cs | 3 | ||||
| -rw-r--r-- | Project-Unite/Project-Unite.csproj | 3 | ||||
| -rw-r--r-- | Project-Unite/Views/Groups/Index.cshtml | 50 |
5 files changed, 103 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/GroupsController.cs b/Project-Unite/Controllers/GroupsController.cs new file mode 100644 index 0000000..96aa401 --- /dev/null +++ b/Project-Unite/Controllers/GroupsController.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Project_Unite.Models; + +namespace Project_Unite.Controllers +{ + public class GroupsController : Controller + { + // GET: Groups + public ActionResult Index() + { + var db = new ApplicationDbContext(); + return View(db.Groups); + } + } +}
\ No newline at end of file diff --git a/Project-Unite/Models/Group.cs b/Project-Unite/Models/Group.cs new file mode 100644 index 0000000..f59270b --- /dev/null +++ b/Project-Unite/Models/Group.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Project_Unite.Models +{ + public class Group + { + public string Id { get; set; } + public string Name { get; set; } + public int Publicity { get; set; } + public string BannerColorHex { get; set; } + public string Description { get; set; } + public string ShortName { get; set; } + + public double RawReputation { get; set; } + + public int Reputation + { + get + { + return ((int)Math.Round(RawReputation)); + } + } + + } +}
\ No newline at end of file diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs index 2e1bf31..46c8e56 100644 --- a/Project-Unite/Models/IdentityModels.cs +++ b/Project-Unite/Models/IdentityModels.cs @@ -30,6 +30,8 @@ namespace Project_Unite.Models // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public class ApplicationUser : IdentityUser { + public string GroupId { get; set; } + public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType @@ -252,6 +254,7 @@ namespace Project_Unite.Models public DbSet<Story> Stories { get; set; } public DbSet<View> Views { get; set; } public DbSet<OAuthToken> OAuthTokens { get; set; } + public DbSet<Group> Groups { get; set; } } public class OAuthToken diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj index 02325a5..e70f34c 100644 --- a/Project-Unite/Project-Unite.csproj +++ b/Project-Unite/Project-Unite.csproj @@ -256,6 +256,7 @@ <Compile Include="Controllers\DeveloperController.cs" /> <Compile Include="Controllers\DownloadController.cs" /> <Compile Include="Controllers\ForumController.cs" /> + <Compile Include="Controllers\GroupsController.cs" /> <Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\LegalController.cs" /> <Compile Include="Controllers\ManageController.cs" /> @@ -441,6 +442,7 @@ <Compile Include="Models\Download.cs" /> <Compile Include="Models\ForumCategory.cs" /> <Compile Include="Models\ForumViewModels.cs" /> + <Compile Include="Models\Group.cs" /> <Compile Include="Models\HomeViewModel.cs" /> <Compile Include="Models\IdentityModels.cs" /> <Compile Include="Models\ManageViewModels.cs" /> @@ -587,6 +589,7 @@ <Content Include="Views\Bugs\PostBug.cshtml" /> <Content Include="Views\Stats\Pong.cshtml" /> <Content Include="Views\Stats\Codepoints.cshtml" /> + <Content Include="Views\Groups\Index.cshtml" /> </ItemGroup> <ItemGroup> <Folder Include="App_Data\" /> diff --git a/Project-Unite/Views/Groups/Index.cshtml b/Project-Unite/Views/Groups/Index.cshtml new file mode 100644 index 0000000..7364df0 --- /dev/null +++ b/Project-Unite/Views/Groups/Index.cshtml @@ -0,0 +1,50 @@ +@model IEnumerable<Project_Unite.Models.Group> + +@{ + ViewBag.Title = "Groups"; +} + +<h2>Groups</h2> + +<p>Groups, formerly called <strong>Legions</strong>, are a way of grouping the community into different, well, groups, with their own tasks and goals.</p> + +<p>You can join one of the in-game groups from your Digital Society Control Centre, or you can join one of the many user-created groups here.</p> + + + +<table class="table"> + <tr> + <th style="width:65%">Group</th> + <th>Users</th> + <th>Actions</th> + </tr> + @if(Model.Count() > 0) + { + foreach(var group in Model) + { + if (group.Publicity < 2) + { + <tr> + <td> + @Html.ActionLink(group.Name, "ViewGroup", "Groups", new { id = group.Id }, null) <br/> + <p><strong>[@group.ShortName]</strong> • @group.Publicity.ToString()</p> + </td> + <td> + @group.Users.Count() + </td> + <td> + @Html.ActionLink("Join", "JoinGroup", "Groups", new { [email protected]}, new { @class="btn btn-default"}) + </td> + </tr> + } + } + } + else + { + <tr> + <td>No groups found! Be the first to create one!</td> + <td></td> + <td></td> + </tr> + } +</table>
\ No newline at end of file |
