public void TestCreateAndListProfileAsync() { ApplicationSeeder.Seed(); var bo = new ProfileBO(); var profile = new Profile("John Doe", "Portugal", DateTime.Now); var resCreate = bo.CreateAsync(profile).Result; var resGet = bo.ReadAsync(profile.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public async Task <IActionResult> New(ProfileVM vm) { if (ModelState.IsValid) { var model = vm.ToProfile(); var createOperation = await _bo.CreateAsync(model); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The record was successfully created.")); } return(View(vm)); }