Exemplo n.º 1
0
        public void TestDeleteStoreQueuesAsync()
        {
            ContextSeeder.Seed();
            var bo        = new StoreQueueBusinessObject();
            var resList   = bo.ListAsync().Result;
            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            resList = bo.ListNotDeletedAsync().Result;
            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0);
        }
Exemplo n.º 2
0
        public void TestUpdateStoreQueueAsync()
        {
            ContextSeeder.Seed();
            var bo       = new StoreQueueBusinessObject();
            var stoQList = bo.ListAsync().Result;
            var item     = stoQList.Result.FirstOrDefault();

            item.Quantity = 11;
            var stoQUpdate = bo.UpdateAsync(item).Result;

            stoQList = bo.ListNotDeletedAsync().Result;
            Assert.IsTrue(stoQList.Success && stoQUpdate.Success && stoQList.Result.First().Quantity == 11);
        }
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListNotDeletedAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }

            var lst = new List <StoreQueueViewModel>();

            foreach (var item in listOperation.Result)
            {
                lst.Add(StoreQueueViewModel.Parse(item));
            }

            var listEOperation = await _ebo.ListNotDeletedAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }

            var elst = new List <EstablishmentViewModel>();

            foreach (var item in listEOperation.Result)
            {
                elst.Add(EstablishmentViewModel.Parse(item));
            }

            var drList = await GetEstablishmentViewModels(listOperation.Result.Select(x => x.EstablishmentId).Distinct().ToList());

            var cList = await GetCompanyViewModels(listEOperation.Result.Select(x => x.CompanyId).Distinct().ToList());

            ViewData["Companies"]      = cList;
            ViewData["Establishments"] = drList;
            ViewData["Title"]          = "Store Queues";
            ViewData["BreadCrumbs"]    = GetCrumbs();
            ViewData["DeleteHref"]     = GetDeleteRef();

            return(View(lst));
        }