57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using WebAPI.Hubs;
|
|
|
|
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
namespace WebAPI.Controllers
|
|
{
|
|
[Route("[controller]")]
|
|
[ApiController]
|
|
public class WhoIsSpyController : ControllerBase
|
|
{
|
|
private readonly IHubContext<WhoIsSpyHub> hubContext;
|
|
|
|
public WhoIsSpyController(IHubContext<WhoIsSpyHub> hubContext)
|
|
{
|
|
this.hubContext = hubContext;
|
|
}
|
|
// GET: api/<WhoIsSpyController>
|
|
[HttpGet]
|
|
public IEnumerable<string> Get()
|
|
{
|
|
return new string[] { "value1", "value2" };
|
|
}
|
|
|
|
// GET api/<WhoIsSpyController>/5
|
|
[HttpGet("{id}")]
|
|
public string Get(string id)
|
|
{
|
|
return "value";
|
|
}
|
|
|
|
// POST api/<WhoIsSpyController>
|
|
[HttpPost]
|
|
public void Post([FromBody] string value)
|
|
{
|
|
hubContext.Clients.All.SendAsync("");
|
|
}
|
|
|
|
// PUT api/<WhoIsSpyController>/5
|
|
[HttpPut("{id}")]
|
|
public void Put(string id, [FromBody] string value)
|
|
{
|
|
}
|
|
|
|
// DELETE api/<WhoIsSpyController>/5
|
|
[HttpDelete("{id}")]
|
|
public void Delete(string id)
|
|
{
|
|
}
|
|
}
|
|
}
|