Beispiel #1
0
        private void listViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListViewItem;
            var id   = (Guid)(item.Content as dynamic).Id;

            var password    = _passwordRepository.GetById(id);
            var passwordDto = password.GetPasswordDto(_password);

            var passwordWindow = new EditPasswordWindow(passwordDto);

            if (passwordWindow.ShowDialog() == true)
            {
                password.UpdatePasswordDto(passwordDto, _password);
                _passwordRepository.Update(password);

                RefreshPasswords();
            }
        }
        public IActionResult Update(Password item)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit", item.ID));
            }

            if (item.Username == null)
            {
                item.Username = "";
            }
            if (item.PasswordValue == null)
            {
                item.PasswordValue = "";
            }
            password_repo.Update(item);

            return(RedirectToAction("Index", "Vault"));
        }
Beispiel #3
0
        public bool Update(Password item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

            try
            {
                //if (session != null)
                //    _repositoryPassword.UnitOfWork.SetConnectionDb(session.ConnectionString);

                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                var validator = EntityValidatorFactory.CreateValidator();
                if (validator.IsValid(item))
                {
                    // Domain Services?
                    //_repositoryPassword.Update(Mapper.Map<Dominio.Entidades.Password>(item));
                    _repositoryPassword.Update(item);
                    committed = _unitOfWorkAsync.SaveChanges();
                }
                else
                {
                    throw new ApplicationValidationErrorsException(validator.GetInvalidMessages(item));
                }
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(ex);
            }

            //LoggerFactory.CreateLog().Stop();
            //_repositoryPassword.Update(entity);
            return(committed > 0);
        }