public void TestCreateAndListCommentAsync() { ApplicationSeeder.Seed(); var bo = new CommentBO(); var foreignBO = new ClientBO(); var comment = new Comment("Tou só a testar", foreignBO.ListUndeleted().Result.First().Id); var resCreate = bo.CreateAsync(comment).Result; var resGet = bo.ReadAsync(comment.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public async Task <IActionResult> New(CommentVM vm) { if (ModelState.IsValid) { var model = vm.ToComment(); var createOperation = await _bo.CreateAsync(model); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The record was successfully created.")); } return(View(vm)); }