/// <summary>
        /// Deletes the asynchronous.
        /// </summary>
        /// <param name="packageImage">The package image.</param>
        /// <returns>
        /// Delete Record Async
        /// </returns>
        /// <exception cref="ArgumentNullException">packageImage</exception>
        public async Task <int> DeletePopularDestinationAsync(PopularDestinationModel packageImage)
        {
            if (packageImage == null)
            {
                throw new ArgumentNullException("packageImage");
            }

            return(await this.popularDestinationRepository.DeleteAsync(packageImage));
        }
Example #2
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>
        /// view
        /// </returns>
        public async Task <IActionResult> PopularDestinationAdd(int id)
        {
            var model = new PopularDestinationViewModel();

            if (id > 0)
            {
                PopularDestinationModel data = await this.homeBanner.GetPopularDestinationByIdAsync(id);

                var result = this.Mapper.Map <PopularDestinationViewModel>(data);
                result.CountryItems = result.CountryId.HasValue && result.CountryId != 0 ? (await this.masterService.GetPackageCountryListAsync(string.Empty, 1, result.CountryId.Value)).ToSelectList() : new List <Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>();
                result.StateItems   = result.StateId.HasValue && result.StateId != 0 ? (await this.masterService.GetPackageStateListAsync(string.Empty, 1, result.StateId.Value)).ToSelectList() : new List <Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>();
                result.CityItems    = result.CityId.HasValue && result.CityId != 0 ? (await this.masterService.GetPackageCityListAsync(string.Empty, 1, result.CityId.Value, 0)).ToSelectList() : new List <Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>();
                return(this.View(result));
            }

            return(this.View(model));
        }
        /// <summary>
        /// Inserts the asynchronous.
        /// </summary>
        /// <param name="popularDestinationModel">The Popular Destination.</param>
        /// <returns>Insert Multiple Records Async</returns>
        /// <exception cref="ArgumentNullException">packageImage</exception>
        public async Task <int> InsertPopularDestinationAsync(PopularDestinationModel popularDestinationModel)
        {
            try
            {
                if (popularDestinationModel == null)
                {
                    throw new ArgumentNullException("packageImage");
                }

                return(await this.popularDestinationRepository.InsertAsync(popularDestinationModel));
            }
            catch (Exception ex)
            {
                var msg = ex.ToString();
                return(0);
            }
        }