Fix backup
Added copy properties between class functions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Step.Model.DatabaseModels;
|
||||
using Step.Model.DTOModels.ToolModels;
|
||||
using Step.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
@@ -224,14 +225,16 @@ namespace Step.Database.Controllers
|
||||
public DbNcToolModel UpdateTool(int toolId, DTONewNcToolModel dtoTool)
|
||||
{
|
||||
DbNcToolModel tool = FindTool(toolId);
|
||||
|
||||
// Update db model
|
||||
tool.FamilyId = dtoTool.FamilyId;
|
||||
tool.OffsetLength = dtoTool.OffsetLength;
|
||||
tool.ResidualLife = dtoTool.ResidualLife;
|
||||
tool.ResidualRevive = dtoTool.ResidualRevive;
|
||||
tool.OffsetId1 = dtoTool.OffsetId1;
|
||||
tool.OffsetId2 = dtoTool.OffsetId2;
|
||||
tool.OffsetId3 = dtoTool.OffsetId3;
|
||||
SupportFunctions.CopyProperties(dtoTool, tool);
|
||||
//tool.FamilyId = dtoTool.FamilyId;
|
||||
//tool.OffsetLength = dtoTool.OffsetLength;
|
||||
//tool.ResidualLife = dtoTool.ResidualLife;
|
||||
//tool.ResidualRevive = dtoTool.ResidualRevive;
|
||||
//tool.OffsetId1 = dtoTool.OffsetId1;
|
||||
//tool.OffsetId2 = dtoTool.OffsetId2;
|
||||
//tool.OffsetId3 = dtoTool.OffsetId3;
|
||||
// Save
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
@@ -265,10 +268,10 @@ namespace Step.Database.Controllers
|
||||
public DbNcFamilyModel UpdateFamily(int familyId, DTONewNcFamilyModel family)
|
||||
{
|
||||
DbNcFamilyModel dbFamily = FindFamily(familyId);
|
||||
dbFamily = (DbNcFamilyModel)family;
|
||||
|
||||
SupportFunctions.CopyProperties(family, dbFamily);
|
||||
|
||||
dbCtx.SaveChanges();
|
||||
dbCtx.Families.Attach(dbFamily);
|
||||
|
||||
return dbFamily;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user