示例#1
0
        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);
        }
示例#2
0
        public async Task SearchByJourneyByName()
        {
            var results = await Journey.GetAllAsync(_azureSql);

            Assert.True(results.Any());
            var selected = results.FirstOrDefault();

            var checkid = await Journey.SearchByJourneyNameAsync(selected.JourneyName, _azureSql);

            var selectedChecked = checkid.FirstOrDefault();

            Assert.Equal(selected.JourneyName, selectedChecked.JourneyName);
        }
        public async Task <IActionResult> SearchJournys(string journeyName)
        {
            if (string.IsNullOrWhiteSpace(journeyName))
            {
                var results = await Journey.GetAllAsync(_azureSQL);

                return(View("Journeys", new JourneysSearchResult
                {
                    Query = journeyName,
                    Journeys = results
                }));
            }
            else
            {
                var results = await Journey.GetByJourneyNameAsync(journeyName, _azureSQL);

                if (!results.Any())
                {
                    results = await Journey.SearchByJourneyNameAsync(journeyName, _azureSQL);
                }
                //else if (results.Count() == 1)
                //{
                //    return Redirect($"/{results.FirstOrDefault().JourneyName}");
                //}

                if (results.Count() > 1)
                {
                    return(View("Journeys", new JourneysSearchResult
                    {
                        Query = journeyName,
                        Journeys = results
                    }));
                }
                //else if (results.Count() == 1)
                //{
                //    return Redirect($"/{results.FirstOrDefault().JourneyName}");
                //}
                else
                {
                    return(View("Journeys", new JourneysSearchResult
                    {
                        Query = journeyName,
                        Journeys = results
                    }));
                }
            }
        }
示例#4
0
        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);
        }
示例#5
0
        public async Task GetAllJourneys()
        {
            var results = await Journey.GetAllAsync(_azureSql);

            Assert.True(results.Any());
        }
        public async Task <IActionResult> IndexAsync()
        {
            var results = await Journey.GetAllAsync(_azureSQL);

            return(View("Index", results));
        }