isotonicq

Untitled

Mar 18th, 2018
148
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public void EditAddress(string personFirstName, string personLastname, string street, string postalCode, string city)
  2.         {
  3.             using (var container = Db4oEmbedded.OpenFile(Resources.Database))
  4.             {
  5.                 var person = container.Query<Person>().FirstOrDefault(x => x.Firstname == personFirstName && x.Lastname == personLastname);
  6.          
  7.                 if (person?.Address == null) return;
  8.                 if (!string.IsNullOrEmpty(street)) person.Address.Street = street;
  9.                 if (!string.IsNullOrEmpty(postalCode)) person.Address.PostalCode = postalCode;
  10.                 if (!string.IsNullOrEmpty(city)) person.Address.City = city;
  11.  
  12.                 container.Store(person.Address);
  13.                 container.Commit();
  14.             }
  15.         }
RAW Paste Data