/// <summary> /// Returns an HTML table of the requests that the authenticated user has initiated /// and are still open. /// </summary> /// <returns></returns> public ActionResult AJAX_GetOpenRequestTable() { string result = "<p>Could not authenticate the request.</p>\n"; if (Request.IsAuthenticated) { DBAccessor dba = new DBAccessor(); result = ""; // Call the database to get pending requests List<Request> requests = dba.GetMyOpenRequests(User.Identity.Name); // Form an HTML table with the retrieved information if (requests.Any()) { result += "<table>\n"; result += "<tr><th>Requested to Join</th><th>Sent On</th><th>Remove</th></tr>\n"; foreach (Request request in requests) { result += "<tr><td>" + request.team.name + "</td><td>" + request.timestamp.ToString("m") + "</td>"; result += "<td><div onClick='action_removerequest(" + request.ID + ")' class='request-action-text clickable-text'>Remove</div></td></tr>"; } result += "</table>\n"; } else { result += "<p>You have no open requests at this time.</p>\n"; } } return Json( new { message = result }, JsonRequestBehavior.AllowGet ); }