public async Task <HomeModel> PrepareModel()
        {
            var orders = await _orderAppService.GetAll();

            var recentOrders = await _orderAppService.GetLastOrders(5);

            var model = new HomeModel()
            {
                Customers = await _repository.CountAsync(),
                Users     = await _userRepository.CountAsync(),
                Products  = await _productRepository.CountAsync(),
            };

            model.Orders = 0;
            if (orders.orders.Any())
            {
                model.Orders = orders.orders.Count();
            }

            model.RecentOrders = new Order.OrderListModel();
            if (recentOrders.orders.Any())
            {
                model.RecentOrders.orders = recentOrders.orders;
            }

            return(model);
        }
        public void GetAll_Should_Should_Return_Correct_Number_Of_Records()
        {
            var institution = UsingDbContext(ctx => ctx.Institution.Add(InitFakeEntity.GetFakeInstitution()));
            var adminEntity = InitFakeEntity.GetFakeAdmin();

            adminEntity.InstitutionId = institution.Id;
            var admin = UsingDbContext(ctx => ctx.Admin.Add(adminEntity));

            for (int i = 0; i < 10; i++)
            {
                Order order = InitFakeEntity.GetFakeOrder();
                order.UserId    = admin.UserId;
                order.OrderRef += i;
                UsingDbContext(ctx => ctx.Order.Add(order));
            }

            PaginationDataList <OrderDto> list = _orderAppService.GetAll(1, null);

            list.CurrentPage.ShouldBe(1);
            list.ListData.Count.ShouldBe(10);
            list.TotalPages.ShouldBe(1);
        }
 public IActionResult Get()
 {
     return(Response(_orderAppService.GetAll()));
 }
Beispiel #4
0
        // GET: Order
        public object Index()
        {
            var result = _OrderAppService.GetAll();

            return(result);
        }
Beispiel #5
0
        public PagedResultOutput <ListOrderDto> GetAll([FromQuery] GetListOrderInputDto inputDto)
        {
            var result = _orderAppService.GetAll(inputDto);

            return(result);
        }
Beispiel #6
0
        public async Task <AjaxResponse <List <OrderDto> > > GetAll()
        {
            var res = await _appservice.GetAll();

            return(new AjaxResponse <List <OrderDto> >(res));
        }
        public async Task <OrderListModel> PrepareListModel()
        {
            var model = await _appService.GetAll();

            return(model);
        }
Beispiel #8
0
 // GET: Order
 public ActionResult Index()
 {
     return(View(_OrderAppService.GetAll()));
 }
Beispiel #9
0
        public async Task <IActionResult> GetAll()
        {
            var data = await _orderAppService.GetAll();

            return(Ok(data));
        }