QrCodeController.cs
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service;
using Hh.Mes.Service.Base;
using Hh.Mes.Service.SystemAuth;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace WebMvc
{
[Route("api/[controller]/[action]")]
[ApiController]
public class QrCodeController : BaseController
{
private readonly SysFileService sysFileService;
private readonly QrCodeListService qrCodeService;
public QrCodeController(IAuth authUtil, SysFileService sysfileService, QrCodeListService qrCodeListService, IHttpContextAccessor accessor):base(authUtil)
{
this.sysFileService = sysfileService;
this.qrCodeService = qrCodeListService;
this.context = accessor.HttpContext;
}
/// <summary>
/// 读数据 http://127.0.0.1:6001/api/QrCode/ReadData
/// </summary>
/// <returns></returns>
[HttpGet]
[ActionName("ReadData")]
public string ReadData(string id)
{
return Serialize(qrCodeService.ReadData(id));
}
/// <summary>
/// 写数据 http://127.0.0.1:6001/api/QrCode/SaveData
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionName("SaveData")]
public string SaveData(QrCodeList qrCodeList)
{
return Serialize(qrCodeService.SaveData(qrCodeList));
}
/// <summary>
/// 删除数据 http://127.0.0.1:6001/api/QrCode/DelData
/// </summary>
/// <returns></returns>
[HttpGet]
[ActionName("DelData")]
public string DelData(string id)
{
return Serialize(qrCodeService.DelData(id));
}
}
}