WIP Added family/tool/shank add API

This commit is contained in:
Lucio Maranta
2018-06-27 13:01:15 +02:00
parent 8c8e168832
commit b5d499e6ed
12 changed files with 298 additions and 145 deletions
@@ -35,6 +35,16 @@ namespace Step.Database.Controllers
return families;
}
public NcToolModel FindTool(int toolId)
{
return dbCtx.Tools
.Include("Offset1")
.Include("Offset2")
.Include("Offset3")
.Where(x => x.ToolId == toolId)
.FirstOrDefault();
}
public List<NcToolModel> GetTools()
{
List<NcToolModel> tools = dbCtx.Tools
@@ -77,6 +87,18 @@ namespace Step.Database.Controllers
return (NcToolModel)tool;
}
public NcToolModel UpdateTool(NcToolModel tool, DTONcToolModel dtoTool)
{
tool.FamilyId = dtoTool.FamilyId;
tool.Type = dtoTool.Type;
tool.OffsetLenght = dtoTool.OffsetLenght;
tool.ResidualLife = dtoTool.ResidualLife;
tool.ResidualRevive = dtoTool.ResidualRevive;
dbCtx.SaveChanges();
return (NcToolModel)tool;
}
public NcFamilyModel AddFamily(DTONcFamilyModel family)
{
@@ -86,5 +108,14 @@ namespace Step.Database.Controllers
return (NcFamilyModel)family;
}
public NcShankModel AddShank(DTONcShankModel shank)
{
dbCtx.Shanks.Add((NcShankModel)shank);
dbCtx.SaveChanges();
return (NcShankModel)shank;
}
}
}