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 RecentAnamnesys(Customer customer) { InitializeComponent(); if (customer != null) { using (var db = new Db.PhisioDB()) { RecentAnamnesy = db.RecentAnamnesys.FirstOrDefault(ra => ra.CustomerId == customer.Id); } if (RecentAnamnesy == null) { RecentAnamnesy = new RecentAnamnesy { Customer = customer, CustomerId = customer.Id }; } } }