Beispiel #1
0
        /// <summary>
        /// 查询建议增加的菜
        /// </summary>
        /// <param name="suggestFoodSearchViewModel"></param>
        /// <returns></returns>
        public List <SuggestFoodSearchMiddleModel> SuggestFood_Search(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
        {
            List <Suggest_Food> suggestFood = _IFoodInfoRepository.SearchSuggestFoodInfoByWhere(suggestFoodSearchViewModel);
            var suggestFood_Info            = _IMapper.Map <List <Suggest_Food>, List <SuggestFoodSearchMiddleModel> >(suggestFood);

            return(suggestFood_Info);
        }
Beispiel #2
0
        public List <Suggest_Food> SearchSuggestFoodInfoByWhereNum(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
        {
            //查询条件
            var predicate = SearchSuggestFoodWhere(suggestFoodSearchViewModel);
            var result    = DbSet3.Where(predicate).OrderByDescending(a => a.AddDate).ToList();

            return(result);
        }
        public ActionResult <SuggestFoodSearchResModel> Manage_Suggest_Search_Food(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
        {
            SuggestFoodSearchResModel suggestFoodSearchResModel = new SuggestFoodSearchResModel();
            var BusSearchResult = _foodService.SuggestFood_Search(suggestFoodSearchViewModel);
            var TotalNum        = _foodService.SuggesttFood_Get_ALLNum(suggestFoodSearchViewModel);

            suggestFoodSearchResModel.suggest_Foods              = BusSearchResult;
            suggestFoodSearchResModel.IsSuccess                  = true;
            suggestFoodSearchResModel.baseViewModel.Message      = "查询成功";
            suggestFoodSearchResModel.baseViewModel.ResponseCode = 200;
            suggestFoodSearchResModel.TotalNum = TotalNum;
            _ILogger.Information("查询意见箱表单信息成功");
            return(Ok(suggestFoodSearchResModel));
        }
Beispiel #4
0
        public List <Suggest_Food> SearchSuggestFoodInfoByWhere(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
        {
            //查询条件
            int SkipNum = suggestFoodSearchViewModel.pageViewModel.CurrentPageNum * suggestFoodSearchViewModel.pageViewModel.PageSize;

            //查询条件
            var predicate = SearchSuggestFoodWhere(suggestFoodSearchViewModel);
            var result    = DbSet3.Where(predicate).OrderByDescending(a => a.AddDate)
                            .Skip(SkipNum)
                            .Take(suggestFoodSearchViewModel.pageViewModel.PageSize)
                            .ToList();

            return(result);
        }
Beispiel #5
0
        //根据条件查询建议添加的菜
        private Expression <Func <Suggest_Food, bool> > SearchSuggestFoodWhere(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
        {
            var predicate = WhereExtension.True <Suggest_Food>();//初始化where表达式

            predicate = predicate.And(p => p.User_Info.UserName.Contains(suggestFoodSearchViewModel.userName));
            if (suggestFoodSearchViewModel.User_DepartId != null)
            {
                predicate = predicate.And(p => p.User_Info.User_DepartId == suggestFoodSearchViewModel.User_DepartId);
            }
            if (suggestFoodSearchViewModel.strDate != null && suggestFoodSearchViewModel.endDate != null)
            {
                predicate = predicate.And(p => p.AddDate >= suggestFoodSearchViewModel.strDate && p.AddDate <= suggestFoodSearchViewModel.endDate);
            }
            predicate = predicate.And(p => p.isDelete == "0");

            return(predicate);
        }
Beispiel #6
0
 /// <summary>
 /// 查询建议增加的菜数量
 /// </summary>
 /// <param name="suggestFoodSearchViewModel"></param>
 /// <returns></returns>
 public int SuggesttFood_Get_ALLNum(SuggestFoodSearchViewModel suggestFoodSearchViewModel)
 {
     return(_IFoodInfoRepository.SearchSuggestFoodInfoByWhereNum(suggestFoodSearchViewModel).Count());
 }