예제 #1
0
        //参赛者个人信息
        public async Task <IActionResult> Details(string id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var participant = await participantService.Find(id);

            if (participant == null)
            {
                return(NotFound());
            }

            return(View(participant));
        }
예제 #2
0
        public async void UpsertExists()
        {
            var service     = new ParticipantService(_config);
            var participant = new Participant()
            {
                firstName = _prefix + ".UpsertDoesNotExist"
            };

            // Create a participant
            var result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 0);


            //Update participant
            participant.lastName = "Different";
            result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 1);


            //verify update
            service = new ParticipantService(_config);
            var findResult = await service.Find(p => p.firstName == participant.firstName);

            Assert.Equal(findResult.Count, 1);
            Assert.Equal(findResult[0].Id, participant.Id);
            Assert.Equal(findResult[0].lastName, "Different");
        }
예제 #3
0
        public async void UpsertDoesNotExist()
        {
            var service     = new ParticipantService(_config);
            var participant = new Participant()
            {
                firstName = _prefix + ".UpsertDoesNotExist"
            };


            var result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 0);

            service = new ParticipantService(_config);
            var findResult = await service.Find(p => p.firstName == participant.firstName);

            Assert.Equal(findResult.Count, 1);
            Assert.Equal(findResult[0].Id, participant.Id);
        }