public async Task <IActionResult> UpdateJourneyAsync([Bind("JourneyId,JourneyName,Bio,GeometryFileName,ImagePath")] Journey newJourney) { if (newJourney != null && !string.IsNullOrWhiteSpace(newJourney.JourneyName) && newJourney.JourneyName.Length <= 100 && !string.IsNullOrWhiteSpace(newJourney.Bio) && newJourney.Bio.Length <= 300 && !string.IsNullOrWhiteSpace(newJourney.GeometryFileName) && newJourney.GeometryFileName.Length <= 300 && !string.IsNullOrWhiteSpace(newJourney.ImagePath) && newJourney.ImagePath.Length <= 100) { newJourney.Active = true; var journey = await Journey.GetByIdAsync(newJourney.JourneyId, _azureSQL); journey.ImagePath = newJourney.ImagePath; journey.GeometryFileName = newJourney.GeometryFileName; journey.Bio = newJourney.Bio; var checkUpdateJourney = await journey.PutAsync(_azureSQL); if (checkUpdateJourney) { return(Redirect($"/Journeys/{journey.JourneyName}")); } } return(Redirect($"/Journeys/{newJourney.JourneyName}")); }
public async Task GetJourneyById() { var results = await Journey.GetAllAsync(_azureSql); Assert.True(results.Any()); var selected = results.FirstOrDefault(); var checkid = await Journey.GetByIdAsync(selected.JourneyId, _azureSql); Assert.Equal(selected.JourneyId, checkid.JourneyId); }
public async Task UpdateAnExistingJourney() { var results = await Journey.GetAllAsync(_azureSql); Assert.True(results.Any()); var selected = results.FirstOrDefault(); var checkid = await Journey.GetByIdAsync(selected.JourneyId, _azureSql); Assert.Equal(selected.JourneyId, checkid.JourneyId); var newBio = $"This is a test Journey created on {DateTime.Now}"; checkid.Bio = newBio; var checkUpdate = await checkid.PutAsync(_azureSql); Assert.True(checkUpdate); }