public virtual CommandResult <bool> Update(TEntity entity) { var result = new CommandResult <bool>(); try { result.ValidationResult = this.ValidateEntity(entity); if (result.ValidationResult.IsValid) { this.EvaluateBusinessRules(entity); _repository.Update(entity); result.DataResult = true; this.Logger.LogDebug("Updating entity of type {0}.", entity); } else { this.Logger.LogWarning("Validator of type " + this._entityValidator.GetType().ToString() + " was not able to validate entity of type " + entity.GetType().ToString()); result.DataResult = false; } } catch (ApplicationException ex) { result.Exception = ex; this.ExceptionManager.HandleException(ex, DefaultExceptionPolicies.BusinessWrapPolicy); } return(result); }
public void Update(TEntity entity) { try { _repository.Update(entity); } catch (ApplicationException ex) { throw new RepositoryException("An error occured while updating an entity.", ex); } }