コード例 #1
0
 public User GetUserByEmail(string email)
 {
     using (var context = new MedFormsContext(_connectionString))
     {
         return(context.Users.FirstOrDefault(u => u.Email == email));
     }
 }
コード例 #2
0
 public void AddCamper(Camper camper)
 {
     using (var context = new MedFormsContext(_connectionString))
     {
         context.Campers.Add(camper);
         context.SaveChanges();
     }
 }
コード例 #3
0
        public void AddUser(User user, string password)
        {
            user.PasswordHash = BCrypt.Net.BCrypt.HashPassword(password);

            using (var context = new MedFormsContext(_connectionString))
            {
                context.Users.Add(user);
                context.SaveChanges();
            }
        }