private async Task Create(CreateOrEditCruiseReductionsDto input)
        {
            CruiseReduction cruiseReductions = ObjectMapper.Map <CruiseReduction>(input);


            if (AbpSession.TenantId != null)
            {
                cruiseReductions.TenantId = AbpSession.TenantId;
            }


            await _cruiseReductionsRepository.InsertAsync(cruiseReductions);
        }
        public async Task SaveReductions(List <ReductionsScreen> reductionsScreen)
        {
            int ActivateOn = 1;

            foreach (var item in reductionsScreen)
            {
                if (item.Id > 0)
                {
                    CruiseReduction cruiseReductions = await _cruiseReductionsRepository.FirstOrDefaultAsync((int)item.Id);

                    cruiseReductions.PassangerNoName = item.PassangerNo;
                    cruiseReductions.ReductionName   = item.ReductionId;
                    cruiseReductions.ReductionAmount = item.ReductionAmount;
                    cruiseReductions.ReductionType   = item.ReductionType;
                    cruiseReductions.ActivateOn      = 1;
                    cruiseReductions.ServicesId      = item.ServiceId;
                    cruiseReductions.AgePoliciesId   = item.AgePolicyId;
                    if (AbpSession.TenantId != null)
                    {
                        cruiseReductions.TenantId = (int?)AbpSession.TenantId;
                    }
                    await _cruiseReductionsRepository.UpdateAsync(cruiseReductions);

                    // Update
                }
                else
                {
                    if (item.AddBlankRow)
                    {
                        ActivateOn++;
                    }

                    CruiseReduction cruiseReductions = new CruiseReduction();
                    cruiseReductions.PassangerNoName = item.PassangerNo;
                    cruiseReductions.ReductionName   = item.ReductionId;
                    cruiseReductions.ReductionAmount = item.ReductionAmount;
                    cruiseReductions.ReductionType   = item.ReductionType;
                    cruiseReductions.ActivateOn      = ActivateOn;
                    cruiseReductions.ServicesId      = item.ServiceId;
                    if (AbpSession.TenantId != null)
                    {
                        cruiseReductions.TenantId = (int?)AbpSession.TenantId;
                    }
                    cruiseReductions.AgePoliciesId = item.AgePolicyId;
                    await _cruiseReductionsRepository.InsertAsync(cruiseReductions);

                    // save
                }
            }
        }
        public async Task <GetCruiseReductionsForEditOutput> GetCruiseReductionsForEdit(EntityDto input)
        {
            CruiseReduction cruiseReductions = await _cruiseReductionsRepository.FirstOrDefaultAsync(input.Id);

            GetCruiseReductionsForEditOutput output = new GetCruiseReductionsForEditOutput {
                CruiseReductions = ObjectMapper.Map <CreateOrEditCruiseReductionsDto>(cruiseReductions)
            };

            if (output.CruiseReductions.ServicesId != null)
            {
                CruiseService _lookupCruiseServices = await _lookup_cruiseServicesRepository.FirstOrDefaultAsync(output.CruiseReductions.ServicesId);

                output.CruiseServicesServiceName = _lookupCruiseServices.ServiceName.ToString();
            }

            if (output.CruiseReductions.AgePoliciesId != null)
            {
                AgePolicy _lookupAgePolicies = await _lookup_agePoliciesRepository.FirstOrDefaultAsync(output.CruiseReductions.AgePoliciesId);

                output.AgePoliciesTenantId = _lookupAgePolicies.TenantId.ToString();
            }

            return(output);
        }
        private async Task Update(CreateOrEditCruiseReductionsDto input)
        {
            CruiseReduction cruiseReductions = await _cruiseReductionsRepository.FirstOrDefaultAsync((int)input.Id);

            ObjectMapper.Map(input, cruiseReductions);
        }