Beispiel #1
0
        public async Task AddCredit(AddCreditDto input)
        {
            var seller = await SellerManager.GetSellerById(input.TargetId);

            var payIn = Domain.Cash.PayIn.MakePayIn(seller.Id, input.Money);

            seller.Credit += payIn.Credit;
            await _payInRepository.InsertAsync(payIn);

            await _sellerRepository.UpdateAsync(seller);
        }
Beispiel #2
0
        public async Task <string> AddCustomerCredit([FromBody] AddCreditDto addCreditDto)
        {
            var(accepted, rejected) = await changeCustomerCreditClient.GetResponse <ChangeCustomerCreditResponse, InputValueRejectedResponse>(new {
                CostomerId = addCreditDto.CustomerId,
                Credit     = addCreditDto.Credit
            });

            if (accepted.IsCompletedSuccessfully)
            {
                var result = await accepted;
                return($"Customer  {addCreditDto.CustomerId} New Credit is  {result.Message.TotalCredit}");
            }
            else
            {
                var result = await rejected;
                return(result.Message.Reason);
            }
        }
 public Task AddCustomerCredit([FromBody] AddCreditDto addCreditDto)
 {
     return(customerService.AddCredit(addCreditDto.Credit, addCreditDto.CustomerId));
 }