Пример #1
0
        public static void DbCreate(BusPar entity)
        {
            var dbe = new Model1();

            dbe.BusPars.Add(entity);
            dbe.SaveChanges();
        }
Пример #2
0
 public static void BusParDelete(BusPar entity)
 {
     using (var dbe = new Model1())
     {
         dbe.BusPars.Attach(entity);
         dbe.BusPars.Remove(entity);
         dbe.SaveChanges();
     }
 }
Пример #3
0
 public static void BusParUpdate(BusPar entity)
 {
     using (var dbe = new Model1())
     {
         dbe.BusPars.Attach(entity);
         dbe.Entry(entity).State = EntityState.Modified;
         dbe.SaveChanges();
     }
 }
Пример #4
0
 public static DAL.BusPar ConvertToBusPar(BusParViewModel bus)
 {
     DAL.BusPar b = new DAL.BusPar
     {
         ID        = bus.ID,
         Code      = bus.Code,
         Name      = bus.Name,
         Comment   = bus.Comment,
         ValueType = bus.ValueType
     };
     return(b);
 }