Gestioner WebApi x REST call
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace GPW_Smart.Controllers
|
||||
{
|
||||
public class TempHistController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using GPW_data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -9,31 +10,63 @@ namespace GPW_Smart.Controllers
|
||||
{
|
||||
public class TempRilController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
// GET api/TempRil
|
||||
public string Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
return "NA";
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string Get(int id)
|
||||
// GET api/TempRil/5
|
||||
public List<chartJsTimeSerie> Get(int id)
|
||||
{
|
||||
return "value";
|
||||
|
||||
|
||||
List<chartJsTimeSerie> answ = new List<chartJsTimeSerie>();
|
||||
|
||||
// recupero dati
|
||||
var tabDati = DataProxy.DP.taRT.getByUserPeriod(id, DateTime.Today, 0);
|
||||
|
||||
foreach (var item in tabDati)
|
||||
{
|
||||
answ.Add(new chartJsTimeSerie() { x = item.dtRilievo, y = item.tempRil });
|
||||
}
|
||||
|
||||
// restituisco oggetto!
|
||||
return answ;
|
||||
}
|
||||
// GET api/TempRil/5?date=2020-09-01&numRec=10
|
||||
public List<chartJsTimeSerie> Get(int id, string date, int numRec)
|
||||
{
|
||||
DateTime dtRif = DateTime.Today;
|
||||
DateTime.TryParse(date, out dtRif);
|
||||
|
||||
List<chartJsTimeSerie> answ = new List<chartJsTimeSerie>();
|
||||
|
||||
// recupero dati
|
||||
var tabDati = DataProxy.DP.taRT.getByUserPeriod(id, dtRif, numRec);
|
||||
|
||||
foreach (var item in tabDati)
|
||||
{
|
||||
answ.Add(new chartJsTimeSerie() { x = item.dtRilievo, y = item.tempRil });
|
||||
}
|
||||
|
||||
// restituisco oggetto!
|
||||
return answ;
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
//// POST api/TempRil
|
||||
//public void Post([FromBody] string value)
|
||||
//{
|
||||
//}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
//// PUT api/TempRil/5
|
||||
//public void Put(int id, [FromBody] string value)
|
||||
//{
|
||||
//}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
//// DELETE api/TempRil/5
|
||||
//public void Delete(int id)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user