Пример #1
0
        public ActionResult GetCoachRequests()
        {
            DBAccessor dba = new DBAccessor();
            List<Request> requests = dba.GetCoachRequests();

            String result = "";
            if (requests.Count > 0) {
                result = "<table>";
                result += "<tr><th>Requestee</th><th>Email</th><th>Action</th></tr>";
                foreach (Request request in requests) {
                    string name = request.requestee.firstName + " " + request.requestee.lastName;
                    result += "<tr><td>" + name + "</td><td>" + request.requestee.email + "</td>";
                    result += "<td><img src='./../Content/images/accept.png' height='20' width='20' class='request-action-image' alt='accept' onClick='action_acceptcoachrequest(" + request.ID + ")' />";
                    result += "<img src='./../Content/images/decline.png' height='20' width='20' class='request-action-image' margin-right='5px' alt='decline' onClick='action_declinecoachrequest(" + request.ID + ")' /></td></tr>";
                }
                result += "</table>";
            }
            else {
                result = "There are no pending coach permission requests.";
            }

            return Json(
                new { message = result },
                JsonRequestBehavior.AllowGet
            );
        }