Example #1
0
 public void InitSize(t_siz_goods good, long oldid=0)
 {
     foreach (var s in context.t_siz_goodsize.Where(t => t.good == oldid))
         s.deleted = 1;
     List<long> sizes = new List<long>(context.t_siz_goods_size.Where(p => p.type == good.sizetype).Select(t => t.id));
     foreach (long t in sizes)
     {
         t_siz_goodsize gs = new t_siz_goodsize() { good = good.id, size = t, sign = 1, deleted = 0 };
         context.t_siz_goodsize.Add(gs);
     }
     context.SaveChanges();
 }
Example #2
0
 public void AddGoodSize(long id, List<t_siz_goodsize> size)
 {
     foreach (var a in context.t_siz_goodsize.Where(t => t.good == id))
         a.deleted = 1;
     context.SaveChanges();
     foreach (var p in size)
     {
         t_siz_goodsize dbEntry = context.t_siz_goodsize.SingleOrDefault(b => b.size == p.size && b.good == p.good);
         if (dbEntry != null)
             dbEntry.deleted = 0;
         else 
             context.t_siz_goodsize.Add(p);
     }
     context.SaveChanges();
 }