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

        public void Create(SkhstudenthdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Skhstudenth oModel = new Skhstudenth();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.Skhstudenths.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(SkhstudenthdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Skhstudenth oModel = db.Skhstudenths.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
 public Skhstudenth_Validation(SkhstudenthdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Skhstudenth_Validation()