private void UpdateSupplier(Supplier supplier) { try { var _supplier = Task.Run(async() => await Find(supplier.Id)).Result; _supplier.FirstName = supplier.FirstName ?? _supplier.FirstName; _supplier.LastName = supplier.LastName ?? _supplier.LastName; _supplier.Telephone = supplier.Telephone ?? _supplier.Telephone; context.Entry <Supplier>(_supplier).State = Microsoft.EntityFrameworkCore.EntityState.Modified; } catch (NotSupportedException ex) { throw ex; } catch (ObjectDisposedException ex) { throw ex; } catch (InvalidOperationException ex) { throw ex; } catch (Exception ex) { throw ex; } }
private void UpdateCustomer(Customer customer) { try { var _customer = Task.Run(async() => await Find(customer.Id)).Result; _customer.FirstName = customer.FirstName ?? _customer.FirstName; _customer.LastName = customer.LastName ?? _customer.LastName; _customer.Email = customer.Email ?? _customer.Email; _customer.BirthDay = customer.BirthDay ?? _customer.BirthDay; context.Entry <Customer>(_customer).State = Microsoft.EntityFrameworkCore.EntityState.Modified; } catch (NotSupportedException ex) { throw ex; } catch (ObjectDisposedException ex) { throw ex; } catch (InvalidOperationException ex) { throw ex; } catch (Exception ex) { throw ex; } }