I am using the code below to log in a user in my winform app
public static Boolean Attempt(String username, String password, bool salted = false)
{
using (InventorySystemEntities context = new InventorySystemEntities(new ConfigurationManager().ConnectionString))
{
password = password.ToMD5(salted);
User = context.Users.SingleOrDefault(u => u.UserName == username
&& u.Password == password && u.IsEnabled == true);
return User != null ? true : false;
}
}
is there a way to access data after the context has been disposed? like using a new context?
User test = Auth.Attempt(txtUsername.Text, txtPassword.Text);
//is there a way to access this?
test.UserGroup.Name;