Пример #1
0
 public static bool Create(Connection.Model.AllGoods AllGoodsInstance)
 {
     using (var context = new Connection.Model.PersianModel())
     {
         try
         {
             context.AllGoods.Add(AllGoodsInstance);
             context.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             System.Windows.Forms.MessageBox.Show(ex.ToString());
             return(false);
         }
     }
 }
Пример #2
0
 public static bool Delete()
 {
     using (var context = new Connection.Model.PersianModel())
     {
         try
         {
             context.AllGoods.RemoveRange(context.AllGoods.ToList());
             context.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             System.Windows.Forms.MessageBox.Show(ex.ToString());
             return(false);
         }
     }
 }
Пример #3
0
 public static bool Update(Connection.Model.Arz ObjectName)
 {
     using (var context = new Connection.Model.PersianModel())
     {
         try
         {
             var Ins = context.Arz.Where(a => a.ArzID == ObjectName.ArzID).FirstOrDefault();
             Ins.ArzName = ObjectName.ArzName;
             Ins.Price   = ObjectName.Price;
             context.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             System.Windows.Forms.MessageBox.Show(ex.ToString());
             return(false);
         }
     }
 }