public IQueryable <AccountBill> GetAllBillsQuery(SearchAccountBillDto input) { return(_repository.QueryNoTracking() .WhereIf(!string.IsNullOrWhiteSpace(input.ItemType), p => p.ItemType.Contains(input.ItemType)) .WhereIf(input.BegDate.HasValue, x => x.AccountDate >= input.BegDate.Value) .WhereIf(input.EndDate.HasValue, x => x.AccountDate <= input.EndDate.Value.AddDays(1).AddSeconds(-1)) .Where(x => x.IsDelete == false && x.CreateUserID == input.UserID) ); }
public async Task <IActionResult> GetBillsList(int?page, int?limit, string searchInput) { SearchAccountBillDto search = string.IsNullOrWhiteSpace(searchInput) ? new SearchAccountBillDto() : JsonConvert.DeserializeObject <SearchAccountBillDto>(searchInput); search.UserID = Convert.ToInt32(User.FindFirstValue(ClaimTypes.Sid)); var lst = await _accountBillService.GetAllBillsQuery(search).ToPagedListAsync(page ?? 0, limit ?? int.MaxValue); var result = new ReturnViewModel <AccountBill>() { count = lst.Total, data = lst.Items }; return(Json(result)); }
public string GetEchartsData() { SearchAccountBillDto search = new SearchAccountBillDto() { UserID = Convert.ToInt32(User.FindFirstValue(ClaimTypes.Sid)), BegDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1) }; var lst = _accountBillService.GetAllBillsQuery(search).ToList(); string json = string.Empty; if (lst.Count() == 0) { AccountBill entity = new AccountBill() { AccountMoney = 0 }; lst.Add(entity); } return(JsonConvert.SerializeObject(lst, Formatting.Indented)); }