Ejemplo n.º 1
0
        public void TestCreateAndReadBrandAsync()
        {
            ContextSeeder.Seed();
            var bo        = new BrandBusinessObject();
            var reg       = new Brand("Dona Ermelinda");
            var resCreate = bo.CreateAsync(reg).Result;
            var resGet    = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 2
0
        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 vm = BrandViewModel.Parse(getOperation.Result);

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

            return(View(vm));
        }
        private async Task <BrandViewModel> GetBrandViewModel(Guid id)
        {
            var getOperation = await _bbo.ReadAsync(id);

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