public void TestCreateNewsletterAsync() { BoraNowSeeder.Seed(); var nbo = new NewsletterBusinessObject(); var news = new Newsletter("New in town, this doughnut place is nuts", "New in town"); var resCreate = nbo.CreateAsync(news).Result; var restGet = nbo.ReadAsync(news.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.Result != null); }
public async Task <IActionResult> Create([Bind("Title, Description")] NewsletterViewModel vm) { if (ModelState.IsValid) { var quiz = vm.ToNewsletter(); var createOperation = await _bo.CreateAsync(quiz); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The record was successfuly created")); } return(View(vm)); }