示例#1
0
        }                       //End public BranchCRUD()

        public void Create(BranchdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Branch oModel = new Branch();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.Branchs.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
示例#2
0
        }                                                                                      //End public void Create

        public void Update(BranchdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Branch oModel = db.Branchs.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
示例#3
0
 //Constructor
 public Branch_Validation(BranchdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Branch_Validation()