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 getCOperation = await _cbo.ReadAsync(getOperation.Result.CategoryId);

            if (!getCOperation.Success)
            {
                return(OperationErrorBackToIndex(getCOperation.Exception));
            }
            if (getCOperation.Result == null)
            {
                return(RecordNotFound());
            }

            var getBOperation = await _bbo.ReadAsync(getOperation.Result.BrandId);

            if (!getBOperation.Success)
            {
                return(OperationErrorBackToIndex(getBOperation.Exception));
            }
            if (getBOperation.Result == null)
            {
                return(RecordNotFound());
            }

            var vm = ProductModelViewModel.Parse(getOperation.Result);

            Draw("Details", "fa-search");

            ViewData["Brand"]    = BrandViewModel.Parse(getBOperation.Result);
            ViewData["Category"] = CategoryViewModel.Parse(getCOperation.Result);
            return(View(vm));
        }
        public void TestCreateAndReadProductModelAsync()
        {
            ContextSeeder.Seed();
            var braBo = new BrandBusinessObject();
            var bra   = braBo.ListNotDeletedAsync().Result.Result.First();
            var catBo = new CategoryBusinessObject();
            var cat   = catBo.ListNotDeletedAsync().Result.Result.First();

            var bo        = new ProductModelBusinessObject();
            var prodMod   = new ProductModel("Vinho Branco", "506-1237-422", "", 4.24, 0.80, Measure.L, bra.Id, cat.Id);
            var resCreate = bo.CreateAsync(prodMod).Result;

            var resGet = bo.ReadAsync(prodMod.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        private async Task <ProductModelViewModel> GetProductModelViewModel(Guid id)
        {
            var getOperation = await _pmbo.ReadAsync(id);

            return(ProductModelViewModel.Parse(getOperation.Result));
        }