Esempio n. 1
0
        }                    //End public SkhCRUD()

        public void Create(SkhdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Skh oModel = new Skh();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.Skhs.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
Esempio n. 2
0
        }                                                                                      //End public void Create

        public void Update(SkhdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Skh oModel = db.Skhs.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    //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;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Esempio n. 3
0
 //Constructor 1
 public Skh_Validation(SkhdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Skh_Validation()