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)); }
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()); }
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); }
public int ListCountShop() { return(_shopRepository.Count(x => x.TrangThai == true || x.TrangThai == false)); }