Aggiunta controller lettura PlantLog e PlantData (DTO)
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace GWMS.UI.Controllers
|
||||
{
|
||||
[Route("api/PlantData")]
|
||||
[ApiController]
|
||||
public class PlantDataController : ControllerBase
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public PlantDataController(GWMSDataService DataService)
|
||||
{
|
||||
_DataService = DataService;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected GWMSDataService _DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
// DELETE api/PlantDataController/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
// GET: api/PlantDataController
|
||||
[HttpGet]
|
||||
public async Task<List<GWMS.Data.DTO.PlantDTO>> Get()
|
||||
{
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
List<GWMS.Data.DTO.PlantDTO> ListRecords = await _DataService.PlantsGetAll();
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
// GET api/PlantDataController/5
|
||||
[HttpGet("{id}")]
|
||||
public async Task<GWMS.Data.DTO.PlantDTO> Get(int id)
|
||||
{
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
var ListRecords = await _DataService.PlantsGetAll();
|
||||
//seleziono plant...
|
||||
var SelRecords = ListRecords.Where(X => X.PlantId == id).FirstOrDefault();
|
||||
return SelRecords;
|
||||
}
|
||||
|
||||
// POST api/PlantDataController
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/PlantDataController/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace GWMS.UI.Controllers
|
||||
{
|
||||
[Route("api/PlantLog")]
|
||||
[ApiController]
|
||||
public class PlantLogController : ControllerBase
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public PlantLogController(GWMSDataService DataService)
|
||||
{
|
||||
_DataService = DataService;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected GWMSDataService _DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
// DELETE api/PlantDataController/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
// GET: api/PlantDataController
|
||||
[HttpGet]
|
||||
public async Task<List<PlantLogModel>> Get()
|
||||
{
|
||||
// arrotondo ai 5 minuti
|
||||
DateTime adesso = DateTime.Now;
|
||||
int dayHour = adesso.Hour;
|
||||
int dayMin = (adesso.Minute / 5) * 5;
|
||||
DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin);
|
||||
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
var ListRecords = await _DataService.PlantLogGetFilt(0, limite, 100);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
// GET api/PlantDataController/5
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<PlantLogModel>> Get(int id)
|
||||
{
|
||||
// arrotondo ai 5 minuti
|
||||
DateTime adesso = DateTime.Now;
|
||||
int dayHour = adesso.Hour;
|
||||
int dayMin = (adesso.Minute / 5) * 5;
|
||||
DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin);
|
||||
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
var ListRecords = await _DataService.PlantLogGetFilt(id, limite, 100);
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
// POST api/PlantDataController
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/PlantDataController/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GWMS.UI", "GWMS.UI\GWMS.UI.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GWMS.User", "GWMS.User\GWMS.User.csproj", "{3112DC8B-4752-4D43-A9A7-41AC40A38DFD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GWMS.API", "GWMS.API\GWMS.API.csproj", "{F455A3A5-89FD-49E3-B5B6-ED8B0DCEC444}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -27,6 +29,10 @@ Global
|
||||
{3112DC8B-4752-4D43-A9A7-41AC40A38DFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3112DC8B-4752-4D43-A9A7-41AC40A38DFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3112DC8B-4752-4D43-A9A7-41AC40A38DFD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F455A3A5-89FD-49E3-B5B6-ED8B0DCEC444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F455A3A5-89FD-49E3-B5B6-ED8B0DCEC444}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F455A3A5-89FD-49E3-B5B6-ED8B0DCEC444}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F455A3A5-89FD-49E3-B5B6-ED8B0DCEC444}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 1.0.2106.2516</h4>
|
||||
<h4>Versione: 1.0.2106.2910</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2106.2516
|
||||
1.0.2106.2910
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2106.2516</version>
|
||||
<version>1.0.2106.2910</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user