예제 #1
0
 } //End public void Update
 public void Delete(int? id)
 {
     try
     {
         using (var db = new DBMAINContext())
         {
             Classlevel oModel = db.Classlevels.Find(id);
             db.Classlevels.Remove(oModel);
             db.SaveChanges();
             this.ID = oModel.ID;
         } //End using
     } //End try
     catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Delete" + e.Message; } //End catch
 } //End public void Delete
예제 #2
0
 } //End public void Create
 public void Update(ClassleveldetailVM poViewModel)
 {
     try
     {
         using (var db = new DBMAINContext())
         {
             Classlevel oModel = db.Classlevels.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
             //Map Form Data
             oModel.InjectFrom(poViewModel);
             //Set Field Header
             oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
             //Set DTA_STS
             oModel.DTA_STS = valFLAG.FLAG_DTA_STS_UPDATE;
             //Process CRUD
             db.Entry(oModel).State = EntityState.Modified;
             db.SaveChanges();
             this.ID = oModel.ID;
         } //End using
     } //End try
     catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
 } //End public void Update
예제 #3
0
 public ClasslevelCRUD() { } //End public ClasslevelCRUD()
 public void Create(ClassleveldetailVM poViewModel)
 {
     try
     {
         using (var db = new DBMAINContext())
         {
             Classlevel oModel = new Classlevel();
             //Map Form Data
             oModel.InjectFrom(poViewModel);
             //Set Field Header
             oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
             //Set DTA_STS
             oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE;
             //Process CRUD
             db.Classlevels.Add(oModel);
             db.SaveChanges();
             this.ID = oModel.ID;
         } //End using
     } //End try
     catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch
 } //End public void Create