Exemplo n.º 1
0
        public async Task <ResultObject> CreateBranchAsync(BranchDto branchDto)
        {
            ResultObject resultObject = new ResultObject();
            //var resultObject = await _accountService.GetBankAccountAmountAsync(0, branchDto.BDN);
            //if (resultObject.ServerErrors.Count > 0)
            //    return resultObject;
            //resultObject.ServerErrors = null;
            //decimal bdnAmount = resultObject.Result == null ? 0 : (decimal)resultObject.Result;
            var branch = _mapper.Map <Branch>(branchDto);

            branch.UserBranches.Add(new UserBranches()
            {
                BranchId = branch.ID,
                UserId   =
                    ConstUserIDs.Administrator
            });

            SetZoneIdForBranch(ref branchDto, ref branch);
            await _branchService.CreateBranchAsync(branch);

            var rsult = await _transactionManager.SaveAllAsync();

            resultObject.Result = branchDto;
            return(resultObject);
        }