} //End public void Create public void Update(SuggestdetailVM poViewModel) { try { using (var db = new DBMAINContext()) { poViewModel.SHORT_DESC = poViewModel.FULL_DESC; Suggest oModel = db.Suggests.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID); SuggesthiddenVM oModelhidden = new SuggesthiddenVM(); oModelhidden.InjectFrom(oModel); poViewModel.InjectFrom(oModelhidden); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE); //Process CRUD db.Entry(oModel).State = EntityState.Modified; db.SaveChanges(); this.ID = oModel.ID; this.TIMELINE_ID = oModel.TIMELINE_ID; } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch } //End public void Update
} //End public SuggestCRUD() public void Create(SuggestdetailVM poViewModel) { try { using (var db = new DBMAINContext()) { Suggest oModel = new Suggest(); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE); //Process CRUD db.Suggests.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