public int Create(Parcel p) { try { _dbContext.Parcels.Add(p); _dbContext.SaveChanges(); return(p.ID); } catch (ArgumentException exc) { throw new DALException($"{exc.GetType()} Exception in {System.Reflection.MethodBase.GetCurrentMethod().Name}", exc); } }
public string Create(Hop hop) { try { _dbContext.Hops.Add(hop); _dbContext.SaveChanges(); return(hop.Code); } catch (ArgumentException 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); } }
public long Create(Webhook hook) { try { _dbContext.Webhooks.Add(hook); _dbContext.SaveChanges(); return(hook.Id); } catch (ArgumentException 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); } }