예제 #1
0
 public User CheckUser(string username, string password)
 {
     var name = username.Trim().ToLower();
     var pass = password.Trim().ToLower();
     var user = new User();
     var userDb = Context.Users.FirstOrDefault(x => x.UserName == name && x.Password == pass && x.Role == Common.RoleUser);
     if (userDb != null)
     {
         user = userDb;
     }
     return user;
 }
예제 #2
0
 public int CreateUser(string username, string password, string signUpRealName, string signUpEmail, string signUpPhone, string signUpStreet, int? locationCityId, int? locationDistrictId)
 {
     var user = new User();
     user.UserName = username;
     user.Password = password;
     user.Email = signUpEmail;
     user.RealName = signUpRealName;
     user.Telephone = signUpPhone;
     user.Address = signUpStreet;
     user.LocationCityId = locationCityId;
     user.LocationDistrictId = locationDistrictId;
     user.Role = Common.RoleUser;
     user.CreatedDate = DateTime.Now;
     Context.Users.Add(user);
     Context.SaveChanges();
     return user.UserId;
 }
예제 #3
0
 public User GetUser(int userId)
 {
     var user = new User();
     var userDb = Context.Users.FirstOrDefault(x => x.UserId == userId);
     if (userDb != null)
     {
         user = userDb;
     }
     return user;
 }