public static ServerReply GET(RequestKontext req) { if (req.Options.Contains("/") == false) //Get - localhost:123123/messages/1 { return(new ServerReply(req.Protocol, "404 Not Found", "", "text")); } string[] frag = req.Options.Split('/'); //---/messages if (frag[1] == "cards" && frag.Length == 2) { string username = req.Authorization; string result = DBManagmentShowCards.Show_acquired_cards(username); if (result == "Error: User is not logged in / Invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", "Error: Not logged in or invalid token", "text")); } else if (result.Contains("Exception caught: ")) { return(BadRequest(req)); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else if (frag[1] == "deck" && frag.Length == 2) { string result = DBManagmentDeck.Show_Deck(req.Authorization); if (result == "No deck found!") { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } else if (result == "Error: User doesn't have a session / invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", result, "text")); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else if (frag[1] == "users" && frag.Length == 3 && frag[2] != "") { if (frag[2] == req.Authorization) { string result = DBManagmentUserData.Show_Players_Data(req.Authorization); if (result == "Error: User doesn't have a session / invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", result, "text")); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else { return(BadRequest(req)); } } else if (frag[1] == "stats" && frag.Length == 2) { string result = DBManagmentStats.Show_stats(req.Authorization); if (result == "Error: User is not logged in / Invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", result, "text")); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else if (frag[1] == "score" && frag.Length == 2) { string result = DBManagment.Show_scoreboard(req.Authorization); if (result == "Error: User is not logged in / Invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", result, "text")); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else if (frag[1] == "tradings" && frag.Length == 2) { string result = DBManagmentTrade.Show_tradings(req.Authorization); if (result == "User doesn't have a session / invalid Token!") { return(new ServerReply(req.Protocol, "401 Unauthorized", result, "text")); } else { return(new ServerReply(req.Protocol, "200 OK", result, "text")); } } else { return(BadRequest(req)); } }
public TeamController(IConfiguration configuration) { Database = new DBManagment(configuration); }
public ScoutTemplateController(IConfiguration configuration) { Database = new DBManagment(configuration); }