//delete public void DeleteModelAuto(Guid ID) { //get exising record to delete ModelAuto recordToDelete = dbContext.ModelAutos.FirstOrDefault(x => x.ID_Model == ID); if (recordToDelete != null) { dbContext.ModelAutos.DeleteOnSubmit(recordToDelete); dbContext.SubmitChanges(); } }
// map orm to model - mapper method private ModelAutoModel MapDbObjectToModel(ModelAuto dbModelAuto) { ModelAutoModel modelAuto = new ModelAutoModel(); if (dbModelAuto != null) { modelAuto.ID_Model = dbModelAuto.ID_Model; modelAuto.ID_Marca = dbModelAuto.ID_Marca; modelAuto.Model = dbModelAuto.Model; return(modelAuto); } return(null); }