63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System.Web.Http;
|
|
|
|
namespace NKC_WF.Controllers
|
|
{
|
|
public class getMUCssRevController : ApiController
|
|
{
|
|
// GET api/getMUCssRev
|
|
public int Get()
|
|
{
|
|
int answ = 0;
|
|
string codPost = "01";
|
|
answ = getRevByPost(codPost);
|
|
return answ;
|
|
}
|
|
// GET api/getMUCssRev/5
|
|
public int Get(int id)
|
|
{
|
|
int answ = 0;
|
|
string codPost = id.ToString("00");
|
|
answ = getRevByPost(codPost);
|
|
return answ;
|
|
}
|
|
|
|
private static int getRevByPost(string codPost)
|
|
{
|
|
int answ;
|
|
// recupero da REDIS!
|
|
string redKey = $"{ComLib.machineUnloadArea(codPost)}:Css";// memLayer.ML.redHash($"MachineUnload:{codPost}:Css");
|
|
string redKeyRev = $"{ComLib.machineUnloadArea(codPost)}:CssRev";// memLayer.ML.redHash($"MachineUnload:{codPost}:CssRev");
|
|
// se vuoto scrivo 1...
|
|
if (!memLayer.ML.redKeyPresent(redKeyRev))
|
|
{
|
|
memLayer.ML.setRCntI(redKeyRev);
|
|
}
|
|
// SE fosse scaduto CSS --> aggiorno revisione...
|
|
if (!memLayer.ML.redKeyPresent(redKey))
|
|
{
|
|
// incremento...
|
|
memLayer.ML.setRCntI(redKeyRev);
|
|
}
|
|
answ = memLayer.ML.getRCnt(redKeyRev);
|
|
return answ;
|
|
}
|
|
|
|
|
|
// 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)
|
|
{
|
|
}
|
|
}
|
|
} |