Esempio n. 1
0
        public virtual async Task <TDomain> Update(TId id, TDomain newEntity, Action <TDomain, TDomain> preProcessAction, Action <TDomain> postProcessAction = null)
        {
            if (newEntity == null)
            {
                ThrowExceptionForNullInputEntity();
            }

            var oldEntity = await GetById(id);

            preProcessAction?.Invoke(oldEntity, newEntity);

            var returnVal = await _entityDataService.Update(newEntity);

            postProcessAction?.Invoke(returnVal);

            return(returnVal);
        }
Esempio n. 2
0
        public virtual TDomain Update(TId id, TDomain newEntity, Action <TDomain, TDomain> preProcessAction, Action <TDomain> postProcessAction = null)
        {
            if (id.IsNullOrEmpty())
            {
                ThrowExceptionForInvalidLookupIdParameter();
            }

            if (newEntity == null)
            {
                ThrowExceptionForNullInputEntity();
            }

            var oldEntity = GetById(id);

            preProcessAction?.Invoke(oldEntity, newEntity);

            var returnVal = EntityDataService.Update(newEntity);

            postProcessAction?.Invoke(returnVal);

            return(returnVal);
        }