public void TestCreateQuizAsync() { BoraNowSeeder.Seed(); var _quiz = new Quiz("Questionário BoraNow"); var _bo = new QuizBusinessObject(); var resCreate = _bo.CreateAsync(_quiz).Result; var resGet = _bo.ReadAsync(_quiz.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public async Task <IActionResult> Create([Bind("Title")] QuizViewModel vm) { if (ModelState.IsValid) { var quiz = vm.ToQuiz(); var createOperation = await _bo.CreateAsync(quiz); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The record was successfuly created")); } return(View(vm)); }