public static User CreateUserData(User user) { user = CreateUserResource(user); user = CreateUserFactor(user); user = AddPlanet(user); return user; }
private void ShowMainForm(User user) { authorisationForm.Hide(); var form = new MainScreen(user); form.Show(); }
public User CreateUser(UserViewModel userViewModel) { var salt = Hash.GenerateSalt(); var newUser = new User() { Email = userViewModel.Email, PasswordHash = Hash.GenerateHash(userViewModel.Password, salt), PasswordSalt = salt, ResourcesUpdatedAt = DateTime.Now }; newUser = UserFactory.CreateUserFactor(newUser); newUser = UserFactory.CreateUserResource(newUser); newUser = UserFactory.AddPlanet(newUser); return newUser; }
public static User CreateUserFactor(User user) { user.UserFactors = new List<UserFactor>(); var factorRepository = new Repository<Factor>(); foreach (Factor factor in factorRepository.Get()) { user.UserFactors.Add( new UserFactor() { User = user, Factor = factor, Value = factor.InitialValue }); } return user; }
public static User CreateUserResource(User user){ user.UserResources = new List<UserResource>(); var resorceRepository = new Repository<Resource>(); foreach (Resource resource in resorceRepository.Get()) { user.UserResources.Add( new UserResource() { User = user, Resource = resource, Amount = resource.InitialValue }); } return user; }
public static User AddPlanet(User user) { var repo = new Repository<Planet>(); var planet = repo.Get().Where(b => b.User == null).First(); if (user.Planets == null) { user.Planets = new List<Planet>(); } planet.User = user; user.Planets.Add(planet); return user; }
public MainScreen(User user) { this.user = user; InitializeComponent(); }