Beispiel #1
0
        }                                                                                      //End public void Create

        public void Update(SongdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Song oModel = db.Songs.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
Beispiel #2
0
        }                     //End public SongCRUD()

        public void Create(SongdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Song oModel = new Song();
                    //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.Songs.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
Beispiel #3
0
 //Constructor
 public Song_Validation(SongdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Song_Validation()