public AnamnesysView(Customer customer) { InitializeComponent(); if (customer != null) { using (var db = new Db.PhisioDB()) { _remoteAnamnesy = db.RemoteAnamnesys.FirstOrDefault(ra => ra.CustomerId == customer.Id); _recentAnamnesy = db.RecentAnamnesys.FirstOrDefault(ra => ra.CustomerId == customer.Id); } } }
public RemoteAnamnesys(Customer customer) { InitializeComponent(); if (customer != null) { using (var db = new Db.PhisioDB()) { RemoteAnamnesy = db.RemoteAnamnesys.FirstOrDefault(ra => ra.CustomerId == customer.Id); } if (RemoteAnamnesy == null) { RemoteAnamnesy = new RemoteAnamnesy { Customer = customer, CustomerId = customer.Id }; } } }