public bool InsertUser(LoginData loginData) { try { var salt = UserServices.GetSalt(); var newUser = new User() { email = loginData.Email, approach = loginData.Approach, active = false, name = loginData.Username, password = BCrypt.Net.BCrypt.HashPassword(loginData.Password + salt), salt = salt, role = Roles.User }; using (MainContext context = new MainContext(new DbContextOptionsBuilder <MainContext>().UseMySql( ConfigurationManager.AppSetting.GetConnectionString("DefaultConnection") ).Options)) { context.Add(newUser); context.SaveChanges(); var shoppingCart = new ShoppingCard() { UserId = newUser.id }; this.__context.Add(shoppingCart); this.__context.SaveChanges(); } if (!newUser.active) { this.SendActivationMail(newUser); } ; return(true); } catch (System.Exception) { return(false); } }
public MainServices() { Users = new UserServices(); Register = new RegisterServices(); }
public MainServices() { Users = new UserServices(); }
public MainServices() { Users = new UserServices(); Post = new PostServices(); }