This commit is contained in:
73
Controllers/BridgeController.cs
Normal file
73
Controllers/BridgeController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
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; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
45
Controllers/ValuesController.cs
Normal file
45
Controllers/ValuesController.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace qbridge.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
// GET api/values
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<string>> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<string> Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/values
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user