public ReturnType AddItemProp(List <ItemProp> itempropList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { foreach (ItemProp itemprop in itempropList) { Alading.Entity.ItemProp DBitemprop = alading.ItemProp.Where(p => p.cid == itemprop.cid && p.pid == itemprop.pid).FirstOrDefault(); if (DBitemprop == null) { alading.AddToItemProp(itemprop); } } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }