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

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

            return(res);
        }
Exemplo 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));
            }
        }
Exemplo n.º 6
0
        // POST: api/Corona
        public string Post([FromBody] Datum datum)
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.InsertDatumEntry(datum));
        }
Exemplo 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)));
        }
Exemplo n.º 8
0
        // GET: api/Corona
        public List <Datum> Get()
        {
            CoronaOperations coop = new CoronaOperations();

            return(coop.GetTheRecords("SELECT * FROM theStats"));
        }
Exemplo n.º 9
0
        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"));
        }