public ReturnType AddLogisticCompany(LogisticCompany logisticcompany) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { alading.AddToLogisticCompany(logisticcompany); if (alading.SaveChanges() == 1) { return(ReturnType.Success); } else { return(ReturnType.PropertyExisted); } } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public ReturnType AddLogisticCompany(List <LogisticCompany> logisticcompanyList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { foreach (LogisticCompany logisticcompany in logisticcompanyList) { alading.AddToLogisticCompany(logisticcompany); } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }