using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MQTTnet; using MQTTnet.Client; using MQTTnet.Server; using MyCore.Models; using MyCore.Services; using static MyCore.Services.OddService; namespace MyCore.Controllers { [Authorize(Roles = "Admin")] [Route("api/test")] [ApiController] public class ValuesController : ControllerBase { private OddService oddService = new OddService(OddService.RegionOdd.UK); // GET api/values /// /// It's a test ! :) /// /// id test [AllowAnonymous] [HttpGet] public ActionResult> Get() { WidgetWeather widgetWeather = new WidgetWeather(); try { League league = new League("BE"); oddService.GetOddsForLeague(league).ContinueWith(res => { if (res.Status == TaskStatus.RanToCompletion) { var test = res.Result; } else { } }); ; } catch (Exception e) { Console.WriteLine(e); } return new string[] { "value1", "value2" }; } // GET api/values/5 [HttpGet("{id}")] public ActionResult Get(int id) { return "value"; } // POST api/values [HttpPost] public void Post([FromBody] string value) { // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 } // PUT api/values/5 [HttpPut("{id}")] public void Put(int id, [FromBody] string value) { // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 } // DELETE api/values/5 [HttpDelete("{id}")] public void Delete(int id) { // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 } } }