--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Projects.Models;
+
+namespace Projects.Controllers
+{
+ public class ActivityController : Controller
+ {
+ private ProjectsDBEntities db = new ProjectsDBEntities();
+
+ // GET: Activity
+ public ActionResult Index()
+ {
+ var results = (from pt in db.ProjectTasks
+ join ts in db.TaskStatuses on pt.task_status_id equals ts.id
+ where ts.status == "Done"
+ group pt.User by pt.User.id into g
+ join u in db.Users on g.Key equals u.id
+ select new ActivityResult { user = u.login, count = g.Count() })
+ .ToList();
+ ViewBag.results = results;
+ return View();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Projects
+{
+ public class ActivityResult
+ {
+ public int count { get; set; }
+ public string user { get; set; }
+ }
+}
\ No newline at end of file
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\Startup.Auth.cs" />
<Compile Include="Controllers\AccountController.cs" />
+ <Compile Include="Controllers\ActivityController.cs" />
+ <Compile Include="Controllers\ActivityResult.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ManageController.cs" />
<Compile Include="Controllers\ProjectTasksController.cs" />
<Content Include="Views\ProjectTasks\Details.cshtml" />
<Content Include="Views\ProjectTasks\Edit.cshtml" />
<Content Include="Views\ProjectTasks\Index.cshtml" />
+ <Content Include="Views\Activity\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<li>@Html.ActionLink("Kontakt", "Contact", "Home")</li>
<li>@Html.ActionLink("Lista projektów", "Index", "Projects")</li>
<li>@Html.ActionLink("Lista zadań", "Index", "ProjectTasks")</li>
+ <li>@Html.ActionLink("Aktywność użytkowników", "Index", "Activity")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>