fix delete x PROD + reshape codice
This commit is contained in:
@@ -208,6 +208,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool DeleteProd(int ProdId)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
var currProd = FindByProdId(ProdId);
|
||||
|
||||
// sel delle BTLParts da proj
|
||||
var machGroup2del = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId);
|
||||
|
||||
try
|
||||
{
|
||||
// remove from database
|
||||
dbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
dbCtx.ProdList.Remove(currProd);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
|
||||
Reference in New Issue
Block a user