Пример #1
0
 public void Add(StateModel p_entity)
 {
     using (var db = new MES_DATABASE())
     {
         db.STA_StateList.Add(MapperState.MapStateToSTA(p_entity));
         db.SaveChanges();
     }
 }
Пример #2
0
        public void Edit(StateModel p_entity)
        {
            var Temp = MapperState.MapStateToSTA(p_entity);

            using (var db = new MES_DATABASE())
            {
                if (!db.STA_StateList.Local.Any(c => c.ID_STA == p_entity.ID_STA))
                {
                    db.STA_StateList.Attach(Temp);
                    db.Entry(Temp).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }