Fix errors on API

Change unload api url
This commit is contained in:
Lucio Maranta
2018-05-24 12:20:51 +02:00
parent d78a209eec
commit f0e483d7aa
8 changed files with 42 additions and 42 deletions
+26 -26
View File
@@ -21,7 +21,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetToolTableData(out List<SiemensToolModel> tools);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(tools);
}
@@ -41,7 +41,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddTool(ref siemensModel);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(siemensModel);
}
@@ -63,7 +63,7 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.UpdateTool(ref siemensModel);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(siemensModel);
}
@@ -78,7 +78,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteTool(id);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -92,7 +92,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetFamiliesData(out List<FamilyModel> families);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(families);
}
@@ -109,7 +109,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddFamily(family.Name, out FamilyModel newFamily);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(newFamily);
}
@@ -127,7 +127,7 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.UpdateFamilyName(oldName, family.Name);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(family);
}
@@ -142,7 +142,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteFamily(name);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -156,7 +156,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetMagazinesPositionsData(out List<PositionModel> magazines);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(magazines);
}
@@ -183,7 +183,7 @@ namespace Step.Controllers.WebApi
// Update
CmsError libraryError = ncHandler.UpdateMagazinePosition(pos);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -197,7 +197,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetShanksData(out List<ShankModel> shanks);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shanks);
}
@@ -216,7 +216,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddShank(ref shank);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shank);
}
@@ -236,7 +236,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.UpdateShank(ref shank);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shank);
}
@@ -251,7 +251,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteShank(id);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -272,7 +272,7 @@ namespace Step.Controllers.WebApi
// Call library add methods
CmsError libraryError = ncHandler.AddEdge(toolId, ref edge);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(edge);
}
@@ -294,7 +294,7 @@ namespace Step.Controllers.WebApi
// Call library add methods
CmsError libraryError = ncHandler.UpdateEdge(toolId, ref edge);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(edge);
}
@@ -309,7 +309,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteEdge(toolId, edgeId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -324,7 +324,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.GetMagazinePositionsAndTools(magazineId, out List<PositionModel> magazinePos);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(magazinePos);
}
@@ -339,7 +339,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.GetNotInMagazinesTools(out List<MountedMultiToolModel> multiTools, out List<MountedToolModel> tools);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(new
{
@@ -363,7 +363,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.LoadToolInMagazine(magazineId, libraryMag);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(newMag);
}
@@ -382,7 +382,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.UnloadToolInMagazine(magazineId, positionId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -400,14 +400,14 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.LoadTooolFromShank(shankId, positionId, toolId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
}
[Route("shank/{shankId:int}/unload/{positionId:int}/{toolId:int}"), HttpPut]
public IHttpActionResult UnloadToolFromShank(int shankId, int positionId, int toolId)
[Route("shank/{shankId:int}/unload/{positionId:int}"), HttpPut]
public IHttpActionResult UnloadToolFromShank(int shankId, int positionId)
{
if (!ModelState.IsValid)
return BadRequest(ModelState);
@@ -416,9 +416,9 @@ namespace Step.Controllers.WebApi
{
ncHandler.Connect();
CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId, toolId);
CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}