public JsonResult PermissionChange(int tournamentId, int targetUser, String action) { if (account.IsLoggedIn()) { Models.Tournament tournament = new Models.Tournament(service, tournamentId); Dictionary <String, int> permissionChange = tournament.PermissionAction(account.Model.AccountID, targetUser, action); if (permissionChange == null) { status = false; message = "An unexpected error occured"; } else { data = new { permissions = permissionChange, isCheckedIn = tournament.isUserCheckedIn(targetUser), targetUser = targetUser }; message = "Permissions are updated"; status = true; } } else { message = "You must be logged in to do this action"; } return(BundleJson()); }
public JsonResult CheckIn(int tournamentId, int tournamentUserId = -1) { Models.Tournament tournament = new Models.Tournament(service, tournamentId); if (tournament.IsAdmin(account.Model.AccountID)) { // Check if a userId was provided first before checking an account if (tournamentUserId != -1) { // An admin is checking in a user status = tournament.CheckUserIn(tournamentUserId); message = "User is " + (status ? "" : "not") + " checked in"; } else if (account.IsLoggedIn()) { // A user with an account is checking in. status = tournament.CheckAccountIn(account.Model.AccountID); message = "Account is " + (status ? "" : "not") + " checked in"; } } else { message = "You can not do this."; } data = new { isCheckedIn = tournament.isUserCheckedIn(tournamentUserId), targetUser = tournamentUserId }; return(BundleJson()); }