Exemple #1
0
 public int DeleteOrder(Order C)
 {
     try
     {
         db.Entry(C).State = EntityState.Deleted;
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #2
0
 public int DeleteProduct(Product P)
 {
     try
     {
         db.Entry(P).State = EntityState.Deleted;
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #3
0
 public int UpdateAddress(Address A)
 {
     try
     {
         db.Entry(A).State = EntityState.Modified;
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
 public int UpdateCreditCardType(CreditCardType A)
 {
     try
     {
         db.Entry(A).State = EntityState.Modified;
         return(db.SaveChanges());
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #5
0
 public virtual int Update(T obj)
 {
     try
     {
         if (ValidateUpdate(obj))
         {
             db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
             return(db.SaveChanges());
         }
         return(0);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }