public async Task CreateOrEdit(CreateOrEditCruisesDto input) { if (input.Id == null) { await Create(input); } else { await Update(input); } }
private async Task Update(CreateOrEditCruisesDto input) { Cruise cruises = await _cruisesRepository.FirstOrDefaultAsync((int)input.Id); cruises.CheckIn = DateTime.ParseExact(input.CheckIn, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); cruises.Checkout = DateTime.ParseExact(input.Checkout, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); cruises.CruiseDuration = input.CruiseDuration; cruises.CruiseStartPort = input.CruiseStartPort; cruises.CruiseEndPort = input.CruiseEndPort; cruises.CruiseIsEnabled = input.CruiseIsEnabled; cruises.CruiseIsEnabledB2B = input.CruiseIsEnabledB2B; cruises.CruiseItinerariesId = input.CruiseItinerariesId; cruises.CruiseServicesId = input.CruiseServicesId; cruises.CruiseShipsId = input.CruiseShipsId; cruises.CruiseThemesId = input.CruiseThemesId; cruises.CruiseYear = input.CruiseYear; cruises.Cruise_Airport = input.Cruise_Airport; cruises.DepositType = input.DepositType; cruises.DisableForApi = input.DisableForApi; cruises.FreeInternet = input.FreeInternet; cruises.StandardDeposit = input.StandardDeposit; cruises.VirtualCruise = input.VirtualCruise; cruises.BookingEmail = input.BookingEmail; cruises.TransferIncluded = input.TransferIncluded; cruises.CruiseOperatorId = input.CruiseOperatorId; if (AbpSession.TenantId != null) { cruises.TenantId = AbpSession.TenantId; } await _cruisesRepository.UpdateAsync(cruises); //ObjectMapper.Map(input, cruises); }
private async Task Create(CreateOrEditCruisesDto input) { Cruise cruises = new Cruise { CheckIn = DateTime.ParseExact(input.CheckIn, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture), Checkout = DateTime.ParseExact(input.Checkout, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture), CruiseDuration = input.CruiseDuration, CruiseStartPort = input.CruiseStartPort, CruiseEndPort = input.CruiseEndPort, CruiseIsEnabled = input.CruiseIsEnabled, CruiseIsEnabledB2B = input.CruiseIsEnabledB2B, CruiseItinerariesId = input.CruiseItinerariesId, CruiseServicesId = input.CruiseServicesId, CruiseShipsId = input.CruiseShipsId, CruiseThemesId = input.CruiseThemesId, CruiseYear = input.CruiseYear, Cruise_Airport = input.Cruise_Airport, DepositType = input.DepositType, DisableForApi = input.DisableForApi, FreeInternet = input.FreeInternet, BookingEmail = input.BookingEmail, TransferIncluded = input.TransferIncluded, CruiseOperatorId = input.CruiseOperatorId, StandardDeposit = input.StandardDeposit, VirtualCruise = input.VirtualCruise }; if (AbpSession.TenantId != null) { cruises.TenantId = AbpSession.TenantId; } await _cruisesRepository.InsertAsync(cruises); }