view for StockBalance view and Wrapping filtering criteria objects
Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult StockBalance()
        {
            var user = _userProfileService.GetUser(User.Identity.Name);
            var codesViewModels = ConstantsService.GetAllCodes();
            var commodityTypeViewModels = _commodityTypeService.GetAllCommodityTypeForReprot();
            var programViewModels = _programService.GetAllProgramsForReport();
            var storeViewModel = _hubService.GetAllStoreByUser(user);
            var viewModel = new StockBalanceViewModel(codesViewModels, commodityTypeViewModels, programViewModels, storeViewModel);

            return View(viewModel);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="viewModel"></param>
 /// <returns></returns>
 public ActionResult StockBalanceReport(StockBalanceViewModel viewModel)
 {
     ViewBag.Program = viewModel.ProgramId == null ? "All" : _programService.GetAllProgram().Where(c => c.ProgramID == viewModel.ProgramId).Select(c => c.Name).Single();
     ViewBag.CommodityTypes = viewModel.CommodityTypeId == null ? "All" : _commodityTypeService.GetAllCommodityType().Where(c => c.CommodityTypeID == viewModel.CommodityTypeId).Select(c => c.Name).Single();
     return PartialView() ;
 }
        public void CanBackPostStockBalanceReport()
        {
            //ACT
            //TODO: Seed data into StockBalanceViewModel before proceding with testing
            var viewModel = new StockBalanceViewModel { };
            var viewResult = _stockManagementController.StockBalanceReport(viewModel) as ViewResult;

            //ASSERT
            Assert.NotNull(viewResult);
            Assert.IsInstanceOf<IEnumerable<Program>>(viewResult.ViewBag.Program);
            Assert.IsInstanceOf<IEnumerable<CommodityType>>(viewResult.ViewBag.CommodityTypes);
        }