//Method that gets user information public UserDTO GetUser(string userName) { string userN = ""; userN = userName; UserDTO UserLogedIn = new UserDTO(); //User user = new User(); User UserDb=new User(); using (var context = new RFQEntities()) { var result = (from usr in context.Users.Include("Company") where usr.UserName == userN select usr).First(); if (result!=null) UserDb = (User)result; } if (UserDb != null) { UserLogedIn.UserID = UserDb.UserID; UserLogedIn.UserName = UserDb.UserName; UserLogedIn.Password = UserDb.Password; UserLogedIn.CompanyID = UserDb.Company.CompanyID; UserLogedIn.CompanyTypeID = UserDb.Company.CompanyTypeID; } return UserLogedIn; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
/// <summary> /// Create a new User object. /// </summary> /// <param name="userID">Initial value of the UserID property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="companyID">Initial value of the CompanyID property.</param> public static User CreateUser(global::System.Int32 userID, global::System.String userName, global::System.String password, global::System.Int32 companyID) { User user = new User(); user.UserID = userID; user.UserName = userName; user.Password = password; user.CompanyID = companyID; return user; }