Exemplo n.º 1
0
        }                                                 //End public void Create

        public void Update(Projectsts_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    Projectsts oModel = db.Projectstss.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <Projectsts_DetailVM, Projectsts>();
                    oModel = Mapper.Map <Projectsts_DetailVM, Projectsts>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_UPDATE;
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
Exemplo n.º 2
0
        }                           //End public ProjectstsCRUD()

        public void Create(Projectsts_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    Projectsts oModel = new Projectsts();
                    //Map Form Data
                    Mapper.CreateMap <Projectsts_DetailVM, Projectsts>();
                    oModel = Mapper.Map <Projectsts_DetailVM, Projectsts>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Process CRUD
                    db.Projectstss.Add(oModel);
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create