/// <summary> /// Indexes the specified model. /// </summary> /// <param name="id">Visa Id</param> /// <returns>View</returns> public async Task <IActionResult> ManageLocation(int id) { LocationDealsAddViewModel model = new LocationDealsAddViewModel(); if (id > 0) { model = this.Mapper.Map <LocationDealsAddViewModel>(await this.homePageService.GetLocationDealByIdAsync(id)); model.CityItems = model.City != null && model.City != 0 ? (await this.masterService.GetTourPackageCityByCounryIdorStateIdAsync(string.Empty, 1, model.Country, 0, (short)model.City)).ToSelectList() : new List <SelectListItem>(); model.CountryItems = model.Country == 0 ? new List <SelectListItem>() : (await this.masterService.GetPackageCountryListAsync(string.Empty, 1, model.Country)).ToSelectList(); } else { model.Id = 0; model.IsActive = true; } return(this.View(model)); }
public async Task <IActionResult> ManageLocation(LocationDealsAddViewModel model) { var data = this.Mapper.Map <LocationDealModel>(model); if (data.Id > 0) { await this.homePageService.UpdateLocationDeal(data); this.ShowMessage("Updated Successfully"); } else { await this.homePageService.AddLocationDeal(data); this.ShowMessage("Inserted Successfully"); } return(this.RedirectToAction("Location")); }