// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Web; using System.Web.Mvc; using Tools.CrashReporter.CrashReportWebSite.Models; namespace Tools.CrashReporter.CrashReportWebSite.Controllers { /// /// The controller to handle associating users with groups. /// public class UsersController : Controller { /// /// Display the main user groups. /// /// A form of user data passed up from the client. /// The name of the current user group to display users for. /// A view to show a list of users in the current user group. public ActionResult Index( FormCollection UserForms, string UserGroup ) { CrashRepository LocalCrashRepository = new CrashRepository(); // Examine an incoming form for a new user group foreach( var FormInstance in UserForms ) { string UserName = FormInstance.ToString(); string NewUserGroup = UserForms[UserName]; LocalCrashRepository.SetUserGroup( UserName, NewUserGroup ); } UsersViewModel Model = new UsersViewModel(); Model.UserGroup = UserGroup; Model.Users = LocalCrashRepository.GetUsersForGroup( UserGroup ); Model.GroupCounts = LocalCrashRepository.GetCountsByGroup(); return View( "Index", Model ); } } }