ValuesController.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. var acc = AccountModel.FindByMail(email);
  25. string transactionId = $"not found: {id} {email}";
  26. var article = ArticleModel.Find(id);
  27. if (article != null && acc != null)
  28. {
  29. var bc = await acc.GetSelectedBlockChain();
  30. transactionId = await SmartContract.Verify(acc, article, bc);
  31. }
  32. return transactionId;
  33. }
  34. // POST api/<ValuesController>
  35. [HttpPost]
  36. public void Post([FromBody] string value)
  37. {
  38. }
  39. // PUT api/<ValuesController>/5
  40. [HttpPut("{id}")]
  41. public void Put(int id, [FromBody] string value)
  42. {
  43. }
  44. // DELETE api/<ValuesController>/5
  45. [HttpDelete("{id}")]
  46. public void Delete(int id)
  47. {
  48. }
  49. }
  50. }