public void TestCreateAndReadShoppingBasketAsync() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var pbo = new ProfileBusinessObject(); var pro = pbo.ListAsync().Result.Result.FirstOrDefault(); var sb = new ShoppingBasket(pro.Id); var resCreate = bo.CreateAsync(sb).Result; var resGet = bo.ReadAsync(sb.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestCreateAndReadShoppingBasketAsync() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var ebo = new EstablishmentBusinessObject(); var resList = ebo.List(); var item = resList.Result.FirstOrDefault(); var sb = new ShoppingBasket(item.Id); var resCreate = bo.CreateAsync(sb).Result; var resGet = bo.ReadAsync(sb.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public async Task <IActionResult> Details(Guid?id) { if (id == null) { return(RecordNotFound()); } var getOperation = await _bo.ReadAsync((Guid)id); if (!getOperation.Success) { return(OperationErrorBackToIndex(getOperation.Exception)); } if (getOperation.Result == null) { return(RecordNotFound()); } var getROperation = await _pbo.ReadAsync(getOperation.Result.ProfileId); if (!getROperation.Success) { return(OperationErrorBackToIndex(getROperation.Exception)); } if (getROperation.Result == null) { return(RecordNotFound()); } var vm = ShoppingBasketViewModel.Parse(getOperation.Result); ViewData["Profile"] = ProfileViewModel.Parse(getROperation.Result); Draw("Details", "fa-search"); return(View(vm)); }
private async Task <ShoppingBasketViewModel> GetShoppingBasketViewModel(Guid id) { var getOperation = await _sbbo.ReadAsync(id); return(ShoppingBasketViewModel.Parse(getOperation.Result)); }