public async Task <ActionResult> Index(Destination?destination, int count = 50) { if (destination.HasValue) { DestinationImageRepository imageRepository = await DestinationImageRepository.Create(); DestinationImage destinationImage = imageRepository.Find(destination.Value); ViewBag.Title = $"{destination} Schedule"; ViewBag.ImageUrl = destinationImage?.ImageURL; string SAStoken = ConfigurationHelper.GetConfigValue("SAStoken"); if ((ViewBag.ImageUrl) != null) { ViewBag.ImageUrl += SAStoken; } } else { ViewBag.Title = "All Schedules"; ViewBag.ImageUrl = null; } ScheduleRepository scheduleRepository = new ScheduleRepository(); IList <Schedule> schedules = await scheduleRepository.GetCategoryAsync(destination, count); return(View(schedules)); }
private async Task UpdateUrl(Destination destination, string url) { DestinationImageRepository imageRepository = await DestinationImageRepository.Create(); DestinationImage destinationImage = imageRepository.Find(destination); if (destinationImage == null) { await imageRepository.AddAsync(new DestinationImage { Id = Guid.NewGuid(), Destination = destination, ImageURL = url }); } else { destinationImage.ImageURL = url; await imageRepository.UpdateAsync(destinationImage); } }