Example #1
0
        public XOFFOperationResult <TModel> Update(TModel entity)
        {
            if (string.IsNullOrWhiteSpace(entity.RemoteId))
            {
                var existingResult = _repository.Get(entity.LocalId);
                if (existingResult.Success)
                {
                    entity.RemoteId = existingResult.Result.RemoteId;
                }
            }

            var repositoryResult = _repository.Upsert(entity);

            if (!repositoryResult.Success)
            {
                return(repositoryResult);
            }


            var queueResult = _changeQueue.QueueUpdate(entity);

            if (!queueResult.Success)
            {
                return(XOFFOperationResult <TModel> .CreateFailure(queueResult.Exception));
            }

            return(repositoryResult);
        }
Example #2
0
 public void Update(TModel entity)
 {
     _repository.Upsert(entity);
     _changeQueue.QueueUpdate(entity);
 }