コード例 #1
0
        public async Task <IActionResult> Execute()
        {
            var obj = new JObject();

            obj.Add(Constants.DtoNames.StatNames.NbProducts, await _productRepository.Count());
            obj.Add(Constants.DtoNames.StatNames.NbServices, await _serviceRepository.Count());
            obj.Add(Constants.DtoNames.StatNames.NbShops, await _shopRepository.Count());
            return(new OkObjectResult(obj));
        }
コード例 #2
0
        public List <Shop> GetShopOnDemand(int start, int length, Dictionary <string, string> searchKey,
                                           out int recordCount)
        {
            //recordCount = 0;
            //var allRecords = _shopRepo.Count();
            var records = _shopRepo.GetAll();

            recordCount = _shopRepo.Count();

            //  var recordWithConditions = Search(allRecords, searchKey);
            // recordCount = recordWithConditions.Count();
            //var data = (length == -1 ? records.OrderBy(a => a.ProjectCustomer.Customer.Id).Skip(start).Take(length).ToList() :
            //    recordWithConditions.OrderBy(a => a.ProjectCustomer.Customer.Id).Skip(start).Take(length).ToList());
            //return data;
            return(records.OrderBy(a => a.Id).Skip(start).Take(length).ToList());
        }
コード例 #3
0
ファイル: OrderedTests.cs プロジェクト: VitaliyNazarets/Store
        public async Task AddDataTest()
        {
            AddDataCalled = true;

            List <Product> list = new List <Product>();

            for (int i = 0; i < 7; i++)
            {
                list.Add(new Product()
                {
                    Name = $"Product {i}", Price = (i % 5) * 20 + 100
                });
            }


            await shopRepository.AddProductsAsync(list).ConfigureAwait(false);

            Assert.Equal(7, shopRepository.Count());
            //verification of the order
            Assert.False(CalculatePriceCalled);
            Assert.False(UpdatePricesCalled);
            Assert.False(PricesUpdatedCorrectlyCalled);
        }
コード例 #4
0
ファイル: ShopService.cs プロジェクト: hoangbuutran/back
 public int ListCountShop()
 {
     return(_shopRepository.Count(x => x.TrangThai == true || x.TrangThai == false));
 }