added cache attribute tags, set expiry to 0seconds on all API endpoints.
This commit is contained in:
parent
50acc1b136
commit
13868a2655
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter
|
||||
@ -17,6 +18,7 @@ namespace WindowsDataCenter
|
||||
|
||||
[HttpGet]
|
||||
[Route("unassigned")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetUnassignedCards()
|
||||
{
|
||||
var unassignedCards = _repo.GetUnassignedIdentifierList();
|
||||
|
||||
@ -6,6 +6,7 @@ using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@ -16,6 +17,7 @@ namespace WindowsDataCenter
|
||||
{
|
||||
|
||||
[Route("")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetTimeLogs([FromUri]int userId, [FromUri]int calendarWeek)
|
||||
{
|
||||
var logList = new TimeLogList();
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Web.Http;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter
|
||||
@ -19,46 +21,53 @@ namespace WindowsDataCenter
|
||||
|
||||
[HttpGet]
|
||||
[Route("")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetUsers([FromUri] string query = "",[FromUri] int pageSize = -1, [FromUri] int pageNumber =-1)
|
||||
{
|
||||
var userList = query == string.Empty ? _repo.GetUsers() : _repo.Search(query);
|
||||
userList.Query = query == string.Empty ? null : query;
|
||||
|
||||
var msg = Request.CreateResponse(HttpStatusCode.OK, userList);
|
||||
|
||||
return ResponseMessage(msg);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id:int}")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetUserDetails(int id)
|
||||
{
|
||||
var ret = _repo.GetUser(id);
|
||||
|
||||
return Ok(ret);
|
||||
var resp = Request.CreateResponse(HttpStatusCode.OK, ret);
|
||||
return ResponseMessage(resp);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("create")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult CreateUser([FromBody] User user)
|
||||
{
|
||||
_repo.UpdateUser(user);
|
||||
int userId;
|
||||
_repo.UpdateUser(user, out userId);
|
||||
//TODO return ID.
|
||||
return ResponseMessage(new HttpResponseMessage(HttpStatusCode.OK) {Content = new StringContent("unknownIdTODO")});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("edit")]
|
||||
[CacheControl(MaxAge=0)]
|
||||
public IHttpActionResult EditUser([FromBody] User user)
|
||||
{
|
||||
_repo.UpdateUser(user);
|
||||
int userId;
|
||||
_repo.UpdateUser(user, out userId);
|
||||
//TODO: MUST HAVE - return user id!
|
||||
return
|
||||
ResponseMessage(new HttpResponseMessage(HttpStatusCode.Created)
|
||||
{
|
||||
//TODO: return ID
|
||||
Content = new StringContent("TODO:return UserID")
|
||||
});
|
||||
var resp = Request.CreateResponse(HttpStatusCode.OK, "TODO:return UserID");
|
||||
return ResponseMessage(resp);
|
||||
//ResponseMessage(new HttpResponseMessage(HttpStatusCode.Created)
|
||||
//{
|
||||
// //TODO: return ID
|
||||
// Content = new StringContent("TODO:return UserID")
|
||||
//});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user