public async Task PostUser([FromBody] UserCreatingModel userModel)
        {
            await _usersService.CreateAsync(userModel, _userManager);

            var tags = _tagsService.CreateOrGet(userModel.Tags);
            var user = _usersService.GetByUsername(userModel.Username);

            _usersService.CreateRelations(user, tags);
        }
        public async Task CreateAsync(UserCreatingModel model, UserManager <User> userManager)
        {
            var user = User.Create(model.Username, model.Name, model.Email, model.Location, null);
            // Add the user to the Db with the choosen password
            await userManager.CreateAsync(user, model.Password);

            await userManager.AddToRoleAsync(user, "RegisteredUser");

            _databaseContext.SaveChanges();
        }
示例#3
0
        public static User Create(UserCreatingModel userModel, List <UserTag> tagsList)
        {
            //add eventlist and achivementlist
            var instance = new User {
                Id = Guid.NewGuid().ToString()
            };

            instance.Update(userModel.Username, userModel.Name, userModel.Email, userModel.Location, tagsList);
            return(instance);
        }
        public void Update(UserCreatingModel userModel, Guid id)
        {
            var user = GetById(id);

            List <UserTag> userTags = new List <UserTag>();

            foreach (var tag in userModel.Tags)
            {
                userTags.Add(new UserTag(user.Id, user, tag.Label, Tag.Create(tag.Label)));
            }

            user.Update(userModel.Username, userModel.Name, userModel.Email,
                        userModel.Location, userTags);

            _databaseContext.Users.Update(user);
        }
 public void UpdateUser([FromBody] UserCreatingModel userModel, [FromRoute] Guid id)
 {
     _usersService.Update(userModel, id);
 }
 public void Create(UserCreatingModel entity)
 {
     throw new NotImplementedException();
 }
示例#7
0
 public async Task CreateAsync(UserCreatingModel model, UserManager <User> userManager)
 {
     await _usersRepository.CreateAsync(model, userManager);
 }
示例#8
0
 public void Update(UserCreatingModel userModel, Guid Id)
 {
     _usersRepository.Update(userModel, Id);
 }
示例#9
0
 public void Create(UserCreatingModel userModel)
 {
     _usersRepository.Create(userModel);
 }