public void Create(UserDto user)
 {
     _userRepo.Create(_mapper.Map <User>(user));
     _userRoleRepo.Create(new UserRole {
         UserId = user.UserId, RoleId = 5
     });
 }
Example #2
0
        public void Register(UserDto user)
        {
            User domainUser = _mapper.Map <User>(user);

            domainUser.Password          = GetHash(domainUser.Password);
            domainUser.AccountRegistered = DateTime.Now;


            _userRepository.Create(domainUser);

            var domainUserId = _userRepository.GetAll($"UserName='******'").FirstOrDefault().UserId;

            _userRoleRepo.Create(new UserRole {
                UserId = domainUserId, RoleId = 4
            });
        }
Example #3
0
        public void Save(string key, MailTemplate mailTemplate)
        {
            var entity = _repository.Query <MailTemplateDefinition>().FirstOrDefault(m => m.Key == key);

            using (var stringWriter = new StringWriter())
            {
                _serializer.Serialize(stringWriter, mailTemplate);

                if (entity == null)
                {
                    entity = new MailTemplateDefinition {
                        Key = key, Data = stringWriter.ToString()
                    };
                    _repository.Create(entity);
                }
                else
                {
                    entity.Data = stringWriter.ToString();
                    _repository.Update(entity);
                }
            }
        }
 public void Create <T>(T entity) where T : class, TEntity
 {
     _general.Create(entity);
 }
 public Usuario Create(Usuario a)
 {
     return(_generalRepository.Create(a));
 }
Example #6
0
 public T Create(T a)
 {
     return(_generalRepository.Create(a));
 }