public ReturnType AddShop(Shop shop) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { alading.AddToShop(shop); 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 AddShop(List <Shop> shopList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { foreach (Shop shop in shopList) { alading.AddToShop(shop); } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }