Esempio n. 1
0
 public static int InsertSupplier(Leverancier l)
 {
     using (var FinalDBEntities = new FinalDBEntities())
     {
         FinalDBEntities.Leveranciers.Add(l);
         if (0 < FinalDBEntities.SaveChanges())
         {
             return(l.LeverancierID);
         }
     }
     return(0);
 }
Esempio n. 2
0
        public static int DeleteSupplier(Leverancier SupplierDelete)
        {
            using (var FinalDBEntities = new FinalDBEntities())
            {
                var query = from Leverancier in FinalDBEntities.Leveranciers
                            where Leverancier.LeverancierID == SupplierDelete.LeverancierID
                            select Leverancier;
                Leverancier leverancier = query.FirstOrDefault();
                FinalDBEntities.Leveranciers.Remove(leverancier);

                return(FinalDBEntities.SaveChanges());
            }
        }