using MapoDb; using SteamWare; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace MP_IO.Controllers.WebAPI { public class IOBController : ApiController { /// /// GET api/IOB /// è un check alive del server /// /// [CacheFilter(TimeDuration = 10)] [HttpGet] public string Get() { if (memLayer.ML.CRB("IOB_RedEnab")) { // conto la richiesta nel contatore REDIS long nCall = memLayer.ML.setRCntI(DataLayer.mHash("COUNT:pCall:IOB_INDEX")); //... se == nCall2Log scrivo su log e resetto long nCall2Log = memLayer.ML.cdvi("nCall2Log"); if (nCall >= nCall2Log) { // loggo logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.INFO); // resetto! memLayer.ML.resetRCnt(DataLayer.mHash("COUNT:pCall:IOB_INDEX")); } } return "OK"; } /// /// GET api/IOB/SIMUL_03 /// Verifica stato enabled di un determinato IOB /// /// /// [CacheFilter(TimeDuration = 5)] [HttpGet] public string Get(string id) { string answ = "ND"; // se id nullo --> KO! if (id == null) { answ = "KO"; } else { try { DataLayer DataLayerObj = new DataLayer(); // salvo risposta! answ = DataLayerObj.insEnab(id) ? "OK" : "NO"; } catch (Exception exc) { logger.lg.scriviLog(string.Format("Errore in enabled{0}{1}", Environment.NewLine, exc)); answ = "NO"; } } return answ; } // POST api/ public void Post([FromBody]string value) { } // PUT api//5 public void Put(int id, [FromBody]string value) { } // DELETE api//5 public void Delete(int id) { } } }