初始化项目
This commit is contained in:
62
AUTS.Web/API/CacheController.cs
Normal file
62
AUTS.Web/API/CacheController.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using AUTS.Domain.ViewModels;
|
||||
using AUTS.Services.Cache;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace AUTS.Web.API
|
||||
{
|
||||
public class CacheController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string ClearCache()
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public HttpResponseMessage closeCache([FromBody]string value)
|
||||
{
|
||||
if (value!=""&&value.Length>0)
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
}
|
||||
ReturnResult<object> result = new ReturnResult<object>
|
||||
{
|
||||
Status = 200,
|
||||
Data = System.Web.HttpContext.Current.Request.UserHostAddress
|
||||
};
|
||||
|
||||
//OBJ转化成JSON
|
||||
string json = JsonConvert.SerializeObject(result);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, Encoding.UTF8, "application/json"),
|
||||
};
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user