private void RemoveSelectedOrganisation() { InspectedOrganisations.Where(organisation => organisation.IsSelected).ToList().ForEach(organisation => _myContext.InspectedOrganisations.Remove(organisation.InspectedOrganisation)); InspectedOrganisations.Where(organisation => organisation.IsSelected).ToList().ForEach(organisation => InspectedOrganisations.Remove(organisation)); _myContext.SaveChanges(); SelectedInspectedOrganisation = new InspectedOrganisationVM(); }
private void RemoveSelectedAddress() { Addresses.Where(address => address.IsSelected).ToList().ForEach(address => _myContext.InspectedOrganisations.Find(SelectedInspectedOrganisation.Id).Addresses.Remove(address.Address)); Addresses.Where(address => address.IsSelected).ToList().ForEach(address => Addresses.Remove(address)); _myContext.SaveChanges(); SelectedInspectedOrganisation = new InspectedOrganisationVM(); SelectedAddress = new AddressVM(); }