public async Task Create(ParticipantViewModel participantViewModel) { Participant participant = mapper.Map<Participant>(participantViewModel); await reposytory.AddAsync(participant); }
public async Task Edit(ParticipantViewModel participantViewModel) { Participant participant = mapper.Map<Participant>(participantViewModel); await reposytory.UpdateAsync(participant); }
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; }
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"); } }
public async Task<ActionResult> Edit(ParticipantViewModel participantViewModel) { await participantService.Edit(participantViewModel); return Content("Participant was Edited!"); }
public async Task<ActionResult> Create(ParticipantViewModel participantViewModel) { await participantService.Create(participantViewModel); return Content("Participant was added!"); }