create git sub-module
Prepare repo for use like sub-module in main repo
This commit is contained in:
46
Diagram-API/Controller/CyclesController.cs
Normal file
46
Diagram-API/Controller/CyclesController.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Diagram_API.Controller
|
||||
{
|
||||
[EnableCors("All")]
|
||||
public class CyclesController : ControllerBase
|
||||
{
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<string> CurrCycles()
|
||||
{
|
||||
var result = new JObject();
|
||||
result["currTime"] = DateTime.Now;
|
||||
|
||||
var tasks = new List<Task<DB.Cycle>>();
|
||||
//var v = new DB.WorkDB();
|
||||
for (var i = 1; i <= 48; i++)
|
||||
tasks.Add(DB.WorkDB.GetCycle(i));
|
||||
|
||||
var arr = new JArray();
|
||||
for (var i = 0; i < tasks.Count; i++)
|
||||
{
|
||||
var tmp = tasks[i].GetAwaiter().GetResult();
|
||||
if (tmp != null)
|
||||
{
|
||||
var t = new JObject();
|
||||
t["vdp"] = tmp.NumVdp;
|
||||
t["cycle"] = tmp.NumCycle;
|
||||
t["factStart"] = tmp.FactStart;
|
||||
t["factEnd"] = tmp.FactEnd;
|
||||
t["thinkEnd"] = tmp.ThinkEnd;
|
||||
arr.Add(t);
|
||||
}
|
||||
}
|
||||
result["data"] = arr;
|
||||
|
||||
return Content(result.ToString(), "application/json");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user