//public async Task<Account> CreateAccountAsync(AccountDto accountDto) //{ // //باز کردن موقتی حساب // accountDto.AccountStatusID = ConstAccountStatuses.Open; // Branch branch = await branchAppService._branchService.GetBranchAsync(accountDto.BranchID); // accountDto.BranchCode = branch.BranchCode; // var account = mapper.Map<Account>(accountDto); // await accountService.CreateAccountAsync(account); // var result = await transactionManager.SaveAllAsync(); // return account; //} public async Task <ResultObject> UpdateCustomerAsync(CustomerHeadDto customerDto) { ResultObject resultObject = new ResultObject(); customerDto.FillCustomerDetail(); var customerHead = _mapper.Map <CustomerHead>(customerDto); // بروز رسانی جزئیات مشتری foreach (var detail in customerHead.CustomerDetails) { if (detail.ID != 0) { var customerDetailTask = await _customerService.UpdateCustomerDetailsAsync(detail); } else { await _customerService.AddCustomerDetailsAsync(detail); } } foreach (var skill in customerDto.Skills) { customerHead.CustomerSkills.Add(new CustomerSkill() { CustomerID = customerHead.ID, SkillID = skill }); } await _customerService.UpdateCustomerSkills(customerHead.CustomerSkills, customerHead.ID); var customerHeadTask = await _customerService.UpdateCustomerAsync(customerHead); await _transactionManager.SaveAllAsync(); resultObject.Result = customerHeadTask.Serial; resultObject.ServerErrors = null; return(resultObject); }