Exemplo n.º 1
0
        private void UpdateEntity(Entities.User entity, UserBase model)
        {
            entity.RoleId      = model.RoleId;
            entity.UserName    = model.UserName;
            entity.Email       = model.Email;
            entity.DisplayName = model.DisplayName;

            //entity.Countries.UpdateManyToMany(
            //    source: model.CountryIds,
            //    keySelectorDestination: _ => _.CountryId,
            //    keySelectorSource: _ => _,
            //    converter: _ => new Entities.UserCountry { CountryId = _ });
        }
Exemplo n.º 2
0
        public async Task <User> CreateAsync(UserBase model)
        {
            model.RejectInvalid();
            await AdditionalValidationAsync(model);

            var entity = new Entities.User();

            UpdateEntity(entity, model);

            _userRepository.Insert(entity);
            await _database.SaveAsync();

            return(Mapper.Map <Entities.User, User>(entity));
        }