コード例 #1
0
        public async Task Create(ParticipantViewModel participantViewModel)
        {

            Participant participant = mapper.Map<Participant>(participantViewModel);

            await reposytory.AddAsync(participant);
        }
コード例 #2
0
        public async Task Edit(ParticipantViewModel participantViewModel)
        {


            Participant participant = mapper.Map<Participant>(participantViewModel);

            await reposytory.UpdateAsync(participant);
        }
コード例 #3
0
ファイル: TestServices.cs プロジェクト: Anton-Ovch/Valtech_
        public bool CheckParticipant(ParticipantViewModel participantViewModel)
        {
            var currentTest = reposytory.Get(participantViewModel.TestId);
            if (currentTest == null)
                return false;

            if (currentTest.Participants.Where(c => c.Name == participantViewModel.Name).Where(m => m.Email == participantViewModel.Email).Count() > 0)
                return true;

            return false;


        }
コード例 #4
0
ファイル: TestController.cs プロジェクト: Anton-Ovch/Valtech_
        public async Task<ActionResult> TestPartial(ParticipantViewModel participantViewModel)
        {
            if (testService.CheckParticipant(participantViewModel) == true)
            {
                TestViewModel testViewModel = await testService.Get(participantViewModel.TestId);

                //  return Json(testViewModel);
                return PartialView(testViewModel);
            }
            else
            {
                Response.StatusCode = (int)HttpStatusCode.NotFound;
                return Content("Participant doesn't exist", "text/html");
            }
        }
コード例 #5
0
 public async Task<ActionResult> Edit(ParticipantViewModel participantViewModel)
 {
     await participantService.Edit(participantViewModel);
     return Content("Participant was Edited!");
 }
コード例 #6
0
 public async Task<ActionResult> Create(ParticipantViewModel participantViewModel)
 {
     await participantService.Create(participantViewModel);
     return Content("Participant was added!");
 }