public async Task <string> CreateExam(ExamInputModel model) { var exam = Mapper.Map <Exam>(model); this.Context.Exams.Add(exam); await this.Context.SaveChangesAsync(); return(exam.Id); }
public async Task <IActionResult> Create(ExamInputModel model) { if (!ModelState.IsValid) { return(this.View(model)); } var id = await this.examService.CreateExam(model); //TODO: redirect to details return(RedirectToAction("Index", "Home")); }