public AccountView Login(Account account)
        {
            string passHash = MD5ACE.Encrypt(account.Password);

            return(GetAll().Result
                   .Where(s => s.Email.ToLower().Trim() == account.Email.ToLower().Trim() && s.Password == passHash)
                   .Select(s => new AccountView
            {
                Id = s.Id,
                Name = s.Name,
                Code = s.Code,
                Address = s.Address,
                DayCreate = (DateTime)s.DayCreate,
                DayEdited = (DateTime)s.DayEdited,
                Description = s.Description,
                Active = (bool)s.Active,
                Dob = (DateTime)s.Dob,
                Email = s.Email,
                ForgotPass = s.ForgotPass,
                Gender = (int)s.Gender,
                Images = s.Images,
                Password = s.Password,
                Phone = s.Phone,
                RoleName = s.Role.Name,
                Status = (bool)s.Status,
                EditerId = (int)s.EditerId
            }).SingleOrDefault());
        }
        public bool UpdatePassword(AccountView accountView)
        {
            Account account = GetById(accountView.Id).Result;

            account.Password   = MD5ACE.Encrypt(accountView.Password);
            account.ForgotPass = null;
            return(Update(account.Id, account).Result);
        }
        public int CreateACE(AccountView accountView)
        {
            int check = CheckCreate(accountView);

            if (check == (int)CheckError.Success)
            {
                Account account = new Account
                {
                    Address     = accountView.Address,
                    Code        = GetCode(),
                    DayCreate   = DateTime.Now,
                    DayEdited   = DateTime.Now,
                    Description = accountView.Description,
                    Dob         = accountView.Dob,
                    Email       = accountView.Email,
                    Gender      = (byte)accountView.Gender,
                    Images      = accountView.Images,
                    Name        = accountView.Name,
                    Password    = MD5ACE.Encrypt(accountView.Password),
                    Phone       = accountView.Phone,
                    RoleId      = (byte)accountView.RoleId,
                    StationId   = accountView.StationId,
                    Status      = true,
                    Active      = true,
                };
                Account account_1 = Add(account).Result;
                if (account_1 == null)
                {
                    return((int)CheckError.ErrorOrther);
                }
                return((int)CheckError.Success);
            }
            else
            {
                return(check);
            }
        }