Ejemplo n.º 1
0
        public Guid Create(Model.Account account)
        {
            account.UserName = account.UserName.Trim();
            account.Password = account.Password.Trim();
            account.Email    = account.Email.Trim();
            account.Tel      = account.Tel.Trim();

            Domain.Account domainAccount = this.mapper.Map <Domain.Account>(account);

            accountRepository.Create(domainAccount);
            accountRepository.SaveChanges();

            return(domainAccount.Id);
        }
Ejemplo n.º 2
0
        public Guid Update(Model.Account account)
        {
            Domain.Account domainAccount = accountRepository.ReadBy(x => x.Id == account.Id);

            if (!string.IsNullOrEmpty(account.UserName))
            {
                domainAccount.UserName = account.UserName.Trim();
                domainAccount.Password = account.Password.Trim();
                domainAccount.Email    = account.Email.Trim();
                domainAccount.Tel      = account.Tel.Trim();
            }
            else
            {
                domainAccount.Disabled = account.Disabled;
            }

            accountRepository.Update(domainAccount);
            accountRepository.SaveChanges();

            return(domainAccount.Id);
        }
Ejemplo n.º 3
0
 public Model.Account ReadByPassword(string password)
 {
     Domain.Account accountPassword = accountRepository.ReadBy(x => x.Password.ToUpper() == password.ToUpper());
     return(this.mapper.Map <Model.Account>(accountPassword));
 }
Ejemplo n.º 4
0
 public Model.Account ReadByName(string username)
 {
     Domain.Account accountName = accountRepository.ReadBy(x => x.UserName.ToUpper() == username.ToUpper());
     return(this.mapper.Map <Model.Account>(accountName));
 }
Ejemplo n.º 5
0
 public Model.Account ReadByID(Guid ID)
 {
     Domain.Account account = accountRepository.ReadBy(x => x.Id == ID);
     return(this.mapper.Map <Model.Account>(account));
 }
Ejemplo n.º 6
0
 public Model.Account ReadBy(string username, string password)
 {
     Domain.Account account = accountRepository.ReadBy(x => x.UserName.ToUpper() == username.ToUpper() && x.Password.ToUpper() == password.ToUpper());
     return(this.mapper.Map <Model.Account>(account));
 }