Fix import-export tool table
Fix mag position page
This commit is contained in:
@@ -557,6 +557,8 @@ namespace Step.Database.Controllers
|
||||
Tools = FindTools(),
|
||||
Families = FindFamilies(),
|
||||
Shanks = FindShanks()
|
||||
.Select(x => { x.MagazineId = null; x.PositionId = null; return x; })
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -566,29 +568,32 @@ namespace Step.Database.Controllers
|
||||
List<DbNcFamilyModel> families = FindFamilies();
|
||||
List<DbNcShankModel> shanks = FindShanks();
|
||||
|
||||
// loop thought new families
|
||||
foreach (var family in data.Families)
|
||||
{
|
||||
// Check if not exist
|
||||
if (families.FirstOrDefault(x => x.FamilyId == family.FamilyId) == null)
|
||||
dbCtx.Families.Add(family);
|
||||
}
|
||||
if(data.Families != null)
|
||||
// loop thought new families
|
||||
foreach (var family in data.Families)
|
||||
{
|
||||
// Check if not exist
|
||||
if (families.FirstOrDefault(x => x.FamilyId == family.FamilyId) == null)
|
||||
dbCtx.Families.Add(family);
|
||||
}
|
||||
|
||||
// loop thought new shanks
|
||||
foreach (var shank in data.Shanks)
|
||||
{
|
||||
// Check if not exist
|
||||
if (shanks.FirstOrDefault(x => x.ShankId == shank.ShankId) == null)
|
||||
dbCtx.Shanks.Add(shank);
|
||||
}
|
||||
if(data.Shanks != null)
|
||||
// loop thought new shanks
|
||||
foreach (var shank in data.Shanks)
|
||||
{
|
||||
// Check if not exist
|
||||
if (shanks.FirstOrDefault(x => x.ShankId == shank.ShankId) == null)
|
||||
dbCtx.Shanks.Add(shank);
|
||||
}
|
||||
|
||||
// loop thought new tools
|
||||
foreach (var tool in data.Tools)
|
||||
{
|
||||
// Check if not exist
|
||||
if (tools.FirstOrDefault(x => x.ToolId == tool.ToolId) == null)
|
||||
dbCtx.Tools.Add(tool);
|
||||
}
|
||||
if(data.Tools != null)
|
||||
// loop thought new tools
|
||||
foreach (var tool in data.Tools)
|
||||
{
|
||||
// Check if not exist
|
||||
if (tools.FirstOrDefault(x => x.ToolId == tool.ToolId) == null)
|
||||
dbCtx.Tools.Add(tool);
|
||||
}
|
||||
|
||||
// Save
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user