Exemple #1
0
        protected bool UpdateEntity(DetailDto dto, string modifiedBy = null)
        {
            var mapper = _mapperFactory.CreateMapperFromDetailDto();
            var entity = mapper.Map <Entity>(dto);

            if (entity is AuditableEntity)
            {
                (entity as AuditableEntity).ModifiedBy = modifiedBy;
            }
            var result = _crudRepo.Update(entity);

            if (result.IsSuccess == ResultType.OK)
            {
                bool isSuccess = _uow.SaveChanges();
                _logger.Info($"{_type.Name} ID = {entity.ID} updated with result {isSuccess}.");
                return(isSuccess);
            }
            throw new UpdateEntityException <Entity>(result.IsSuccess.ToString());
        }