From a0d902f464449d2eb5becb6eb48cd1e24f1b5a04 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 16 Sep 2019 14:56:43 +0200 Subject: [PATCH] Fix dei due metodi API x CSS --- NKC_WF.sln | 8 --- NKC_WF/Controllers/ValuesController.cs | 35 ----------- NKC_WF/Controllers/getMUCssController.cs | 62 +++++++++++++++++++ ...Controller.cs => getMUCssRevController.cs} | 10 +-- NKC_WF/NKC_WF.csproj | 4 +- 5 files changed, 67 insertions(+), 52 deletions(-) delete mode 100644 NKC_WF/Controllers/ValuesController.cs create mode 100644 NKC_WF/Controllers/getMUCssController.cs rename NKC_WF/Controllers/{MachineCssController.cs => getMUCssRevController.cs} (67%) diff --git a/NKC_WF.sln b/NKC_WF.sln index a180a88..a2ca481 100644 --- a/NKC_WF.sln +++ b/NKC_WF.sln @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppData", "AppData\AppData. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersGen", "VersGen\VersGen.csproj", "{175AF851-9AED-4D5F-8571-9CEC8B2D2320}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO", "IO\IO.csproj", "{0990A432-E9A4-45D0-81D6-782B9DC2382E}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,12 +34,6 @@ Global {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Debug-LELE|Any CPU.Build.0 = Debug|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.ActiveCfg = Release|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.Build.0 = Release|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug-LELE|Any CPU.ActiveCfg = Debug|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Debug-LELE|Any CPU.Build.0 = Debug|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0990A432-E9A4-45D0-81D6-782B9DC2382E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NKC_WF/Controllers/ValuesController.cs b/NKC_WF/Controllers/ValuesController.cs deleted file mode 100644 index f5c1442..0000000 --- a/NKC_WF/Controllers/ValuesController.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using System.Web.Http; - -namespace NKC_WF.Controllers -{ - public class ValuesController : ApiController - { - // GET api/values - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - public string Get(int id) - { - return "value"; - } - - // POST api/values - public void Post([FromBody]string value) - { - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - } -} diff --git a/NKC_WF/Controllers/getMUCssController.cs b/NKC_WF/Controllers/getMUCssController.cs new file mode 100644 index 0000000..2af7a3f --- /dev/null +++ b/NKC_WF/Controllers/getMUCssController.cs @@ -0,0 +1,62 @@ +using System; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; + +namespace NKC_WF.Controllers +{ + public class getMUCssController : ApiController + { + // GET api/ + public HttpResponseMessage Get() + { + string filename = HttpContext.Current.Server.MapPath("~/Content/SheetColor.css"); + string answ = File.ReadAllText(filename); + // rendo dinamico in base al secondo pari/dispari il mio #IT00006 + int secondi = DateTime.Now.Second; + if (secondi % 2 == 0) + { + answ += "#IT000006 {fill: orange;}"; + answ += "#IT000003 {fill: orange; .flashStroke; .strokeThick;}"; + + } + else + { + answ += "#IT000006 {fill: blue;}"; + answ += "#IT000003 {fill: blue; .flashStroke; .strokeThick;}"; + } + + //return answ; + + + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(answ, Encoding.UTF8, "text/css") + }; + } + + // GET api//5 + public string Get(int id) + { + return "value"; + } + + // 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) + { + } + } +} \ No newline at end of file diff --git a/NKC_WF/Controllers/MachineCssController.cs b/NKC_WF/Controllers/getMUCssRevController.cs similarity index 67% rename from NKC_WF/Controllers/MachineCssController.cs rename to NKC_WF/Controllers/getMUCssRevController.cs index 3006e8c..c8284c5 100644 --- a/NKC_WF/Controllers/MachineCssController.cs +++ b/NKC_WF/Controllers/getMUCssRevController.cs @@ -1,18 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Web.Http; namespace NKC_WF.Controllers { - public class MachineCssController : ApiController + public class getMUCssRevController : ApiController { // GET api/ - public IEnumerable Get() + public int Get() { - return new string[] { "value1", "value2" }; + return DateTime.Now.Second; } // GET api//5 diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index cee89b0..0b427ab 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -362,8 +362,8 @@ Contact.aspx - - + + Default.aspx ASPXCodeBehind