public void TestCreateInterestPointNewsletterAsync() { BoraNowSeeder.Seed(); var ipnbo = new InterestPointNewsletterBusinessObject(); var nbo = new NewsletterBusinessObject(); var cbo = new CompanyBusinessObject(); var ipbo = new InterestPointBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var news = new Newsletter("New in town, this doughnut place is nuts", "New in town"); var company = new Company("a", "b", "c", "123333", profile.Id); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); nbo.Create(news); cbo.Create(company); ipbo.Create(interestPoint); var interestPointNews = new InterestPointNewsletter(interestPoint.Id, news.Id); var resCreate = ipnbo.CreateAsync(interestPointNews).Result; var restGet = ipnbo.ReadAsync(interestPointNews.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.Result != null); }
public async Task <IActionResult> Create([Bind("InterestPointId, NewsLetterId")] InterestPointNewsletterViewModel vm) { if (ModelState.IsValid) { var InterestPointNewsletter = vm.ToInterestPointNewsletter(); var createOperation = await _bo.CreateAsync(InterestPointNewsletter); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The record was successfuly created")); } return(View(vm)); }