Exemple #1
0
 public int UpdateVipCards(IEnumerable <vipCard> items)
 {
     using (IOPContext db = new IOPContext())
     {
         VipCardConverter converter = new VipCardConverter(db);
         foreach (var item in items)
         {
             var model = converter.FromDto(item);
             db.Entry(model).State = System.Data.Entity.EntityState.Modified;
         }
         return(db.SaveChanges());
     }
 }
Exemple #2
0
 public int AddVipCards(IEnumerable <vipCard> items)
 {
     using (IOPContext db = new IOPContext())
     {
         List <VipCard>   list      = new List <VipCard>();
         VipCardConverter converter = new VipCardConverter(db);
         foreach (var item in items)
         {
             var model = converter.FromDto(item);
             list.Add(model);
         }
         db.VipCards.AddRange(list);
         return(db.SaveChanges());
     }
 }