public static void UpdateUser(User user) { using (AladingWebEntities context = ContextProvider.DataContext(ConnectionHelper.ConnectionString)) { var old = context.User.FirstOrDefault(p => p.UserCode == user.UserCode); if (old != null) { context.Attach(old); context.ApplyPropertyChanges("User", user); context.SaveChanges(); } } }
public static void UpdateShop(Shop shop) { using (AladingWebEntities context = ContextProvider.DataContext(ConnectionHelper.ConnectionString)) { var old = context.Shop.FirstOrDefault(c => c.ShopCode == shop.ShopCode); if (old != null) { context.Attach(old); context.ApplyPropertyChanges("Shop", shop); context.SaveChanges(); } } }