예제 #1
0
        //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();
            }
        }
예제 #2
0
        // 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);
        }