Exemple #1
0
 public void Update(Parcel p)
 {
     try
     {
         Parcel parcel = GetByID(p.ID);
         if (parcel != null)
         {
             _dbContext.Entry(parcel).CurrentValues.SetValues(p);
             _dbContext.SaveChanges();
         }
     }
     catch (ArgumentException exc)
     {
         throw new DALException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc);
     }
 }
 public void Update(Hop h)
 {
     try
     {
         Hop hop = GetByCode(h.Code);
         if (hop != null)
         {
             _dbContext.Entry(hop).CurrentValues.SetValues(h);
             _dbContext.SaveChanges();
         }
     }
     catch (SqlException exc)
     {
         throw new DALException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc);
     }
     catch (Exception exc)
     {
         throw new DALException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc);
     }
 }