Exemplo n.º 1
0
        public async Task <bool> CreateAccount(RegisterAccountModel model, CancellationToken token = default)
        {
            var account = model.MapToAccount(_scopeControl.GetUserId());

            if (account.IsInValid())
            {
                _scopeControl.AddNotifications(account.Notifications);
                return(false);
            }

            if (token.IsCancellationRequested)
            {
                return(false);
            }

            _repository.Add(account);
            return(await _repository.UnitOfWork.Commit(token));
        }
Exemplo n.º 2
0
        public async Task <bool> Create(CreateTagModel model, CancellationToken token = default)
        {
            var tag = model.MapToTag(_scopeControl.GetUserId());

            if (tag.IsInValid())
            {
                _scopeControl.AddNotifications(tag.Notifications);
                return(false);
            }

            if (token.IsCancellationRequested)
            {
                return(false);
            }

            _repository.Add(tag);
            return(await _repository.UnitOfWork.Commit(token));
        }