Exemple #1
0
        public ActionResult EventApplication(int ID, string button)
        {
            EventApplicationModel eventApplication = new EventApplicationModel();

            eventApplication.ID = ID;
            Console.WriteLine("id: " + eventApplication.ID);
            Console.WriteLine("btn: " + button);

            if (button == "refresh")
            {
                StringBuilder applicationListHtml = new StringBuilder("<table id=\"pplTbl\"><tr><th>ID</th><th>Event ID</th><th>Club ID</th><th>Club Name</th><th>Gender</th><th>Date</th></tr>");
                events = SqliteDataAccess.LoadEventApplication();

                int i = 1;

                foreach (var app in events)
                {
                    applicationListHtml.Append("<tr id=" + i + "><td>");
                    applicationListHtml.Append(app.ID);
                    applicationListHtml.Append("</td><td>");
                    applicationListHtml.Append(app.eventID);
                    applicationListHtml.Append("</td><td>");
                    applicationListHtml.Append(app.clubID);
                    applicationListHtml.Append("</td><td>");
                    applicationListHtml.Append(app.clubname);
                    applicationListHtml.Append("</td><td>");
                    applicationListHtml.Append(app.gender);
                    applicationListHtml.Append("</td><td>");
                    applicationListHtml.Append(app.startdate);
                    applicationListHtml.Append("</td></tr>");
                }

                applicationListHtml.Append("</table>");

                Console.WriteLine(applicationListHtml);

                TempData["EventApps"] = applicationListHtml.ToString();
            }
            else if (button == "accept" && ID != 0)
            {
                eventApplication.eventID = SqliteDataAccess.SingleObjectString(eventApplication, "eventapplication", "ID", "eventID");
                eventApplication.clubID  = Int32.Parse(SqliteDataAccess.SingleObjectString(eventApplication, "eventapplication", "ID", "clubID"));

                Console.WriteLine("event id: " + eventApplication.eventID);
                Console.WriteLine("club id: " + eventApplication.clubID);
                SqliteDataAccess.ApproveEvent(eventApplication);
            }
            else if (button == "deny" && ID != 0)
            {
                SqliteDataAccess.DenyEvent(eventApplication);
            }
            else
            {
                Console.WriteLine("Shit went wrong!");
            }


            return(RedirectToAction("Managment", "Home"));
        }