From 52933477b71a741b03d71105890e856cbf491a18 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 16 Nov 2020 14:23:52 +0100 Subject: [PATCH] Abbozzato controller x DbMaint in MON --- MP-IO/Controllers/WebAPI/DbMaintController.cs | 57 ------------------- MP-IO/MP-IO.csproj | 1 - MP-MON/Controllers/DbTaskController.cs | 20 ++++--- MP-MON/Global.asax.cs | 32 ++++++----- 4 files changed, 31 insertions(+), 79 deletions(-) delete mode 100644 MP-IO/Controllers/WebAPI/DbMaintController.cs diff --git a/MP-IO/Controllers/WebAPI/DbMaintController.cs b/MP-IO/Controllers/WebAPI/DbMaintController.cs deleted file mode 100644 index fb038bbd..00000000 --- a/MP-IO/Controllers/WebAPI/DbMaintController.cs +++ /dev/null @@ -1,57 +0,0 @@ -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 DbMaintController : ApiController - { - #region Public Methods - - // DELETE api//5 - public void Delete(int id) - { - } - - /// - /// GET api/DbMaint - /// Esegue tutte le manutenzioni configurate x il DB - /// - /// - /// - [CacheFilter(TimeDuration = 5)] - [HttpGet] - public string Get() - { - return $"DbMaint executed - {DateTime.Now}"; - } - - /// - /// GET api/DbMaint/parameter - /// Esegue una singola manutenzione configurata x il DB - /// - /// - /// - [CacheFilter(TimeDuration = 5)] - [HttpGet] - public string Get(string id) - { - return $"DbMaint requested: {id} - {DateTime.Now}"; - } - - // POST api/ - public void Post([FromBody] string value) - { - } - - // PUT api//5 - public void Put(int id, [FromBody] string value) - { - } - - #endregion Public Methods - } -} \ No newline at end of file diff --git a/MP-IO/MP-IO.csproj b/MP-IO/MP-IO.csproj index e39703cf..06568143 100644 --- a/MP-IO/MP-IO.csproj +++ b/MP-IO/MP-IO.csproj @@ -304,7 +304,6 @@ - default.aspx diff --git a/MP-MON/Controllers/DbTaskController.cs b/MP-MON/Controllers/DbTaskController.cs index f8315f0f..f22f0153 100644 --- a/MP-MON/Controllers/DbTaskController.cs +++ b/MP-MON/Controllers/DbTaskController.cs @@ -9,6 +9,13 @@ namespace MP_MON.Controllers { public class DbTaskController : ApiController { + #region Public Methods + + // DELETE: api/DbTask/5 + public void Delete(int id) + { + } + // GET: api/DbTask public IEnumerable Get() { @@ -18,22 +25,19 @@ namespace MP_MON.Controllers // GET: api/DbTask/5 public string Get(int id) { - return "value"; + return $"DbMaint requested: {id} - {DateTime.Now}"; } // POST: api/DbTask - public void Post([FromBody]string value) + public void Post([FromBody] string value) { } // PUT: api/DbTask/5 - public void Put(int id, [FromBody]string value) + public void Put(int id, [FromBody] string value) { } - // DELETE: api/DbTask/5 - public void Delete(int id) - { - } + #endregion Public Methods } -} +} \ No newline at end of file diff --git a/MP-MON/Global.asax.cs b/MP-MON/Global.asax.cs index 119a3895..94a01b15 100644 --- a/MP-MON/Global.asax.cs +++ b/MP-MON/Global.asax.cs @@ -1,21 +1,27 @@ -using System.Web.Mvc; +using System.Web.Http; +using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; namespace MP_MON { - public class MvcApplication : System.Web.HttpApplication - { - protected void Application_Start() + public class MvcApplication : System.Web.HttpApplication { - // Codice eseguito all'avvio dell'applicazione - AreaRegistration.RegisterAllAreas(); - FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); - RouteConfig.RegisterRoutes(RouteTable.Routes); - BundleConfig.RegisterBundles(BundleTable.Bundles); + #region Protected Methods - // avvio il metodo init x applicazione... - MP_Startup.Init(); + protected void Application_Start() + { + // Codice eseguito all'avvio dell'applicazione + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); + RouteConfig.RegisterRoutes(RouteTable.Routes); + BundleConfig.RegisterBundles(BundleTable.Bundles); + + // avvio il metodo init x applicazione... + MP_Startup.Init(); + } + + #endregion Protected Methods } - } -} +} \ No newline at end of file