public RegisterErrors Register(User newUser) { var errors = RegisterErrors.None; if(_context.Users.Any(user => user.Username == newUser.Username)) { errors |= RegisterErrors.UsernameTaken; } if(_context.Users.Any(user => user.Email == newUser.Email)) { errors |= RegisterErrors.EmailTaken; } if (errors == RegisterErrors.None) { _context.Users.Add(newUser); try { _context.SaveChanges(); } catch (DbUpdateException) { errors |= RegisterErrors.DataBaseError; } catch (DbEntityValidationException) { errors |= RegisterErrors.DataBaseError; } } return errors; }
public void RegisterUser(User user) { }