public ReturnType AddItemSellerAuthorize(ItemSellerAuthorize itemsellerauthorize) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { ItemSellerAuthorize result = alading.ItemSellerAuthorize.Where(p => p.SellerNick == itemsellerauthorize.SellerNick && p.Cid == itemsellerauthorize.Cid).FirstOrDefault(); if (result == null) { alading.AddToItemSellerAuthorize(itemsellerauthorize); } else { result.Name = itemsellerauthorize.Name; } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public ReturnType AddItemSellerAuthorize(List <ItemSellerAuthorize> itemsellerauthorizeList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { foreach (ItemSellerAuthorize itemsellerauthorize in itemsellerauthorizeList) { alading.AddToItemSellerAuthorize(itemsellerauthorize); } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }