private Stream ShowImage(int id) { using (var theGateContext = new TheGateContext()) { var file = theGateContext.Files.First(f => f.fileID == id); return new MemoryStream(file.Data); } }
public SitePage() { _theGateContext = new TheGateContext(); var userID = Membership.GetUser() != null ? (Guid)Membership.GetUser().ProviderUserKey : Guid.Empty; _contact = theGateContext.Contacts.Where(c => c.userID == userID).FirstOrDefault(); }