diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/LogsController.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/LogsController.cs index 24d0730..5a3d8b4 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/LogsController.cs +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/LogsController.cs @@ -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 @@ -28,30 +24,20 @@ namespace WindowsDataCenter.Controllers _repo = repo; _logger = logger; } - - /// - /// - /// - /// - /// + [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);