ValuesController.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Microsoft.AspNetCore.Mvc;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using HyperCube.Models;
  7. // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
  8. namespace HyperCube.Controllers
  9. {
  10. [Route("api/[controller]")]
  11. [ApiController]
  12. public class ValuesController : ControllerBase
  13. {
  14. // GET: api/<ValuesController>
  15. [HttpGet]
  16. public IEnumerable<string> Get()
  17. {
  18. return new string[] {};
  19. }
  20. // GET api/<ValuesController>/5
  21. [HttpGet("{id}/{email}")]
  22. public async Task<string> Get(int id, string email)
  23. {
  24. string transactionId = $"not found: {id} {email}";
  25. var article = ArticleModel.Find(id);
  26. if (article != null)
  27. transactionId = await SmartContract.Verify(article);
  28. return transactionId;
  29. }
  30. // POST api/<ValuesController>
  31. [HttpPost]
  32. public void Post([FromBody] string value)
  33. {
  34. }
  35. // PUT api/<ValuesController>/5
  36. [HttpPut("{id}")]
  37. public void Put(int id, [FromBody] string value)
  38. {
  39. }
  40. // DELETE api/<ValuesController>/5
  41. [HttpDelete("{id}")]
  42. public void Delete(int id)
  43. {
  44. }
  45. }
  46. }