Skip to content

Commit

Permalink
feat: fix customer contact info display
Browse files Browse the repository at this point in the history
Signed-off-by: russkyc <[email protected]>
  • Loading branch information
russkyc committed Jun 20, 2023
1 parent 097468e commit e27d967
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public partial class CustomerCardViewModel : ObservableObject, IEntity
[ObservableProperty]
private string? _address;

[ObservableProperty]
private string? _email;

[ObservableProperty]
private string? _contactNumber;

[ObservableProperty]
private SynchronizedObservableCollection<Pet> _pets;

Expand Down
17 changes: 17 additions & 0 deletions Russkyc.GroomWise/ViewModels/Customers/CustomersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ void GetCustomers()
customervm.Address = address.PrimaryAddress;
var customerContactInfo = _dbContext.CustomerContactInfoRepository.Find(
address => address.CustomerId == customer.Id
);
if (customerContactInfo == null)
return;
var contactInfo = _dbContext.ContactInfoRepository.Find(
contactInfo => contactInfo.Id == customerContactInfo.ContactInfoId
);
if (contactInfo == null)
return;
customervm.ContactNumber = contactInfo.ContactNumber;
customervm.Email = contactInfo.Email;
var customerPets = _dbContext.CustomerPetRepository
.FindAll(pet => pet.OwnerId == customer.Id)
.ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@
Margin="12,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Email Test"
Text="{Binding Email, UpdateSourceTrigger=PropertyChanged}"
TextAlignment="Left" />
<ItemsControl Grid.Column="4"
Width="120"
Margin="12,0,12,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Expand Down

0 comments on commit e27d967

Please sign in to comment.