public async Task <BaseEntityResponse <NotifyConfigGroup> > Handle(AddNotifyConfigGroupCommand request,
                                                                           CancellationToken cancellationToken)
        {
            var response = new BaseEntityResponse <NotifyConfigGroup>(true, null);
            var query    = _notifyConfigGroupRepository.Add(new NotifyConfigGroup(request.Title, request.Ord,
                                                                                  request.AppId));

            response.SetData(query);
            await _unitOfWork.CommitAsync(cancellationToken);

            return(response);
        }
Exemple #2
0
        public async Task <BaseEntityResponse <IList <Resource> > > GetResources()
        {
            var response = new BaseEntityResponse <IList <Resource> >();

            await TryCatchAsync(async() =>
            {
                var data = await accessClient.GetResources(appConfig.AppGroupResourceKey);

                response.SetData(data)
                .Successful();

                return(response);
            }, response);

            return(response);
        }
        public Task <BaseEntityResponse <BankAccountView> > GetBankAccountById(int BankAccountId)
        {
            var response = new BaseEntityResponse <BankAccountView>();

            TryCatch(() =>
            {
                var model = bankAccountService.GetById(BankAccountId);
                if (model == null)
                {
                    throw new ErrorCodeException(ErrorCodeDefine.GET_BANK_ACCOUNT);
                }

                var dataMappig = AutoMapper.Mapper.Map <Bank_Account, BankAccountView>(model);

                response.SetData(dataMappig).Successful();
            }, response);
            return(Task.FromResult(response));
        }