73 lines
1.6 KiB
C#
73 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace qbridge.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[Produces("application/json")]
|
|
public class BridgeController : ControllerBase
|
|
{
|
|
|
|
public BridgeController()
|
|
{
|
|
|
|
}
|
|
|
|
// GET: api/Todo/5
|
|
[HttpGet("{login}/{password}")]
|
|
public async Task<ActionResult<QItem>> Get(string login, string password)
|
|
{
|
|
var QItem = new QItem();
|
|
QItem.Token1 = "Test token 1";
|
|
QItem.Token2 = System.DateTime.Now.ToString();
|
|
QItem.Token3 = login;
|
|
|
|
if (QItem == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
return QItem;
|
|
}
|
|
|
|
|
|
public class QItem
|
|
{
|
|
|
|
public string Token1 { get; set; }
|
|
public string Token2 { get; set; }
|
|
public string Token3 { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
// POST: api/Todo
|
|
[HttpPost]
|
|
public async Task<ActionResult<QItem>> Post(QCreds creds)
|
|
{
|
|
var q = new QItem();
|
|
q.Token1 = "Test token 1";
|
|
q.Token2 = System.DateTime.Now.ToString();
|
|
q.Token3 = creds.Login;
|
|
return Ok(q);
|
|
//return CreatedAtAction(nameof(GetTodoItem), new { id = item.Id }, item);
|
|
}
|
|
|
|
public class QCreds
|
|
{
|
|
|
|
public string Login { get; set; }
|
|
public string Password { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |