public void AgreementCancelledDomainEventHandler(AgreementCancelledDomainEvent @event)
        {
            _agreementRepository.Update(@event.Source);

            var agreementCancelled = new AgreementCancelled
            {
                Id = @event.Source.Id.Value
            };

            _bus.Publish(agreementCancelled);
        }
예제 #2
0
 // PUT api/values/object
 public void Put(int id, [FromBody] AgreementCreateBindingModel value)
 {
     try
     {
         repository.Update(value.Id, value.Name, value.Number, value.BegDate, value.EndDate, value.Deleted);
     }
     catch (AggregateException ex)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }
예제 #3
0
        public void UpdateAgreement(Agreement newAgreement)
        {
            SetTempOrderAgreemenr(newAgreement);

            _agreementRepository.Update(newAgreement);

            if (tempOrderAgreement != null &&
                _orderAgreementRepository.GetAllByExpression()
                .Where(ordAgr => ordAgr.OrderId == tempOrderAgreement.OrderId).ToList() == null)
            {
                _orderAgreementRepository.Add(tempOrderAgreement);
            }
        }
예제 #4
0
        public async Task <IActionResult> ApplyAgreement(int id, [FromBody] ActivateAgreementDto activateAgreementDto)
        {
            var agreementFromRepo = await this._agreementRepo.GetSingle(id);

            if (agreementFromRepo == null)
            {
                return(BadRequest());
            }

            if (await this._customerRepo.GetSingle(activateAgreementDto.CustomerId) == null)
            {
                return(BadRequest());
            }

            agreementFromRepo.Status          = 2;
            agreementFromRepo.IsLoanActivated = false;
            agreementFromRepo.LeftToPay       = agreementFromRepo.LoanAmount;

            await _agreementRepo.Update(agreementFromRepo);

            var agreementDto = _mapper.Map <AgreementDto>(agreementFromRepo);

            return(Ok(agreementDto));
        }
 public void AgreementSuspendedDomainEventHandler(AgreementSuspendedDomainEvent @event)
 {
     _agreementRepository.Update(@event.Source);
 }
예제 #6
0
 public Task <AgreementResponse> Update(Guid id, AgreementRequest model) => _agreementRepository.Update(id, model);