// Copyright 1998-2015 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 Crashes = new CrashRepository(); // Examine an incoming form for a new user group foreach( var FormInstance in UserForms ) { string UserName = FormInstance.ToString(); string NewUserGroup = UserForms[UserName]; FRepository.Get( Crashes ).SetUserGroup( UserName, NewUserGroup ); } UsersViewModel Model = new UsersViewModel(); Model.UserGroup = UserGroup; Model.Users = FRepository.Get( Crashes ).GetUserNamesFromGroupName( UserGroup ); Model.GroupCounts = FRepository.Get( Crashes ).GetCountsByGroup(); return View( "Index", Model ); } } }