// POST: api/Corona
        public bool Post(Datum datum)
        {
            CoronaOperations coop = new CoronaOperations();
            bool             res  = coop.insertRecord(datum);

            return(res);
        }
Esempio n. 2
0
        // POST: api/Corona
        public bool Post([FromBody] Datum value)
        {
            CoronaOperations coop = new CoronaOperations();
            bool             res  = coop.PostTheRecords(value);

            return(res);
        }
Esempio n. 3
0
        // POST: api/Corona
        public string Post([FromBody] Datum value)
        {
            // Acquiring connection with database
            CoronaOperations coop = new CoronaOperations();

            // Send POST request, returns message saying whether insert was sucesfull or not
            return(coop.InsertNewRecord(value) == true ? "Successful" : "Error");
        }
        // POST: api/Corona
        public HttpResponseMessage Post([FromBody] Datum newEntry)
        {
            CoronaOperations coop = new CoronaOperations();
            int x = coop.InsertRecord(string.Format("INSERT INTO theStats(countrycode, date, cases, deaths, recovered) VALUES('{0}','{1}','{2}','{3}','{4}')", newEntry.countrycode, newEntry.date, newEntry.cases, newEntry.deaths, newEntry.recovered));

            if (x == 1)
            {
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.Conflict));
            }
        }
        // POST: api/Corona
        public HttpResponseMessage Post(Datum newDatum)
        {
            string query = "INSERT INTO theStats (countrycode, date, cases, deaths, recovered)";

            query += " VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')";
            CoronaOperations coop = new CoronaOperations();

            if (coop.PutTheRecord(string.Format(query, newDatum.countrycode, newDatum.date, newDatum.cases, newDatum.deaths, newDatum.recovered)))
            {
                return(new HttpResponseMessage(HttpStatusCode.Created));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.Conflict));
            }
        }
Esempio n. 6
0
        // POST: api/Corona
        public string Post([FromBody] Datum datum)
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.InsertDatumEntry(datum));
        }
Esempio n. 7
0
        // GET: api/Corona
        public List <Datum> Get(string country)
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.GetTheRecords(string.Format("SELECT * FROM theStats WHERE countrycode = '{0}'", country)));
        }
Esempio n. 8
0
        // GET: api/Corona
        public List <Datum> Get()
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.GetTheRecords("SELECT * FROM theStats"));
        }
        public bool Post([FromBody] Datum value)
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.InsertData(value));
        }
        // POST: api/Corona
        public void Post([FromBody] Datum datum)
        {
            CoronaOperations coop = new CoronaOperations();

            coop.InsertRecord(datum);
        }
        public List <Datum> Get()
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.GetTheRecords(100, "ASC"));
        }