Ejemplo n.º 1
0
        public string addUserLogin([FromBody] UserLogin user) //checked --works
        {
            string queryString = "EXEC addUser '" + user.Username +
                                 "' , '" + user.Password + "' ;";

            try{
                DBWrapper.sendCommand(queryString);
            } catch (Exception e) {
                System.Console.Error.Write(e);
            }

            return("ok");
        }
        public IActionResult updateUserSubscriptions([FromBody] UserSubscription alerts)
        {
            string queryString = "EXEC updateUserSubs '" +
                                 alerts.Username + "', " +
                                 (alerts.Alert1 ? 1 : 0) + ", " +
                                 (alerts.Alert2 ? 1 : 0) + ", " +
                                 (alerts.Alert3 ? 1 : 0) + ", " +
                                 (alerts.Alert4 ? 1 : 0) + ", " +
                                 (alerts.Alert5 ? 1 : 0) + ", '" +
                                 JsonConvert.SerializeObject(alerts.CustomAlert) + "' ;";

            try{
                DBWrapper.sendCommand(queryString);
            } catch (Exception e) {
                System.Console.Error.WriteLine(e);
                return(Ok(false));
            }
            return(Ok(true));
        }