added cache control attributes.
tidied code. removed commenting for now. need to add this in shortly. #29
This commit is contained in:
parent
64018ef8db
commit
f1371f1f99
@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter.Controllers
|
||||
namespace WindowsDataCenter
|
||||
{
|
||||
[RoutePrefix("api/logs")]
|
||||
public class LogsController:ApiController
|
||||
@ -29,29 +25,19 @@ namespace WindowsDataCenter.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("create")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult CreateAndEditResultLog([FromBody] TimeLog log)
|
||||
{
|
||||
log.Source = LogSource.UI;
|
||||
if (log.Id > 0)
|
||||
{
|
||||
_repo.UpdateLog(log);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.CreateLog(log);
|
||||
}
|
||||
return Ok();
|
||||
var resp = log.Id > 0 ? _repo.UpdateLog(log) : _repo.CreateLog(log);
|
||||
return Ok(new {Id=log.Id, OperationResponse=resp});
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Route("delete")]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult DeleteLog([FromBody] TimeLog log)
|
||||
{
|
||||
_logger.Info("Removing Log {0} for user id {1}", log.Id, log.UserId);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user