public async Task CreateOrEdit(CreateOrEditAccountPaymentsDto input) { if (!input.Id.HasValue) { await Create(input); } else if (input.Id == 0) { await Create(input); } else if (input.Id > 0) { await Update(input); } }
protected virtual async Task Create(CreateOrEditAccountPaymentsDto input) { _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant); var accountPayments = ObjectMapper.Map <AccountPayment>(input); if (AbpSession.TenantId != null) { accountPayments.TenantId = (int)AbpSession.TenantId; } await _accountPaymentsRepository.InsertAsync(accountPayments); if (input.ConfirmReservation) { var tblReservation = _reservationsRepository.GetAll().Where(x => x.Id == input.ReservationId).FirstOrDefault(); tblReservation.ReservationLocked = true; tblReservation.ReservationStatus = 5; await _reservationsRepository.UpdateAsync(tblReservation); } }
protected virtual async Task Update(CreateOrEditAccountPaymentsDto input) { var accountPayments = await _accountPaymentsRepository.FirstOrDefaultAsync((int)input.Id); ObjectMapper.Map(input, accountPayments); }