Added api to modify offsets

And magazine signalR
This commit is contained in:
Lucio Maranta
2018-08-29 17:02:51 +02:00
parent a54dd90472
commit 2e22f4db3d
10 changed files with 183 additions and 24 deletions
@@ -233,6 +233,41 @@ namespace Step.Controllers.WebApi
#endregion Tools
#region Offsets
[Route("offset/{offsetId:int}"), HttpPut]
public IHttpActionResult UpdateOffset(short offsetId, OffsetModel offsetData)
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.UpdateOffset(offsetId, offsetData);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
offsetData.Id = offsetId;
return Ok(offsetData);
}
}
[Route("tool/{toolId:int}/position/{positionId:int}/offset/{offsetId:int}"), HttpPut]
public IHttpActionResult UpdateToolOffset(int toolId, int positionId, short offsetId)
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.UpdateToolOffsetId(toolId, positionId, offsetId, out DTONcToolModel tool);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
return Ok(tool);
}
}
#endregion
#region Shanks
[Route("shanks"), HttpGet]
@@ -673,21 +708,5 @@ namespace Step.Controllers.WebApi
return Ok();
}
}
[Route("offset/{offsetId:int}"), HttpPut]
public IHttpActionResult UpdateOffset(short offsetId, OffsetModel offsetData)
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.UpdateOffset(offsetId, offsetData);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
offsetData.Id = offsetId;
return Ok(offsetData);
}
}
}
}