예제 #1
0
        //check and get article with paging and array
        public IQueryable <FoodView> GetDistinctFoodRecordList(ForDateTime Date, int?days, String Username)
        {
            //use to accept all search data
            IQueryable <FoodRecord> SearchData;

            SearchData = GetAllFoodRecordList();
            DateTime currentDate = Date.CurrentDate.AddDays(Convert.ToDouble(-days));

            var query = (from s in SearchData
                         where DbFunctions.TruncateTime(s.CreateDate) > currentDate
                         where s.Username == Username
                         group s.FoodName by new
            {
                fooname = s.FoodName,
                calories = s.Calories,
            }
                         into g
                         select new FoodView
            {
                FoodName = g.Key.fooname,
                Calories = g.Sum(a => g.Key.calories),
                Count = g.Count()
            });


            return(query);
        }
예제 #2
0
        // get SportRecord into list by date
        //check and get article with paging and array
        public List <SportRecord> GetSportRecordList(ForDateTime Date, String Username)
        {
            //use to accept all search data
            IQueryable <SportRecord> SearchData;

            SearchData = GetAllSportRecordList();
            DateTime currentDate = Date.CurrentDate;

            var query = from s in SearchData
                        where DbFunctions.TruncateTime(s.CreateDate) == currentDate
                        where s.Username == Username
                        select s;

            return(query.ToList());
        }
예제 #3
0
        //check and get article with paging and array
        public List <TotalCaloriesResult> GetTotalCaloriesList(ForDateTime Date, String Username)
        {
            //use to accept all search data
            IQueryable <TotalCaloriesResult> SearchData;

            SearchData = db.TotalCaloriesResult;
            DateTime currentDate = Date.CurrentDate;

            var query = from s in SearchData
                        where DbFunctions.TruncateTime(s.CreateDate) == currentDate
                        where s.Username == Username
                        select s;


            return(query.ToList());
        }
예제 #4
0
        //check and get article with paging and array
        public List <Article> GetArticleRecordList(ForDateTime Date)
        {
            //use to accept all search data
            IQueryable <Article> SearchData;

            SearchData = GetAllArticleRecordList();
            DateTime currentDate = Date.CurrentDate;

            var query = from s in SearchData
                        where DbFunctions.TruncateTime(s.CreateDate) == currentDate
                        orderby s.CreateDate descending
                        select s;


            return(query.ToList());
        }
예제 #5
0
        //check and get article with paging and array
        public IQueryable <TotalCaloriesResultViewCustom> GetTotalCaloriesList(ForDateTime Date, int?days, String Username)
        {
            //use to accept all search data
            IQueryable <TotalCaloriesResult> SearchData;

            SearchData = db.TotalCaloriesResult;
            DateTime currentDate = Date.CurrentDate.AddDays(Convert.ToDouble(-days));

            var query = (from s in SearchData
                         where DbFunctions.TruncateTime(s.CreateDate) > currentDate
                         where s.Username == Username
                         select new TotalCaloriesResultViewCustom
            {
                breakfastCalories = s.BreakfastCalories,
                lunchCalories = s.LunchCalories,
                dinnerCalories = s.DinnerCalories,
                date = s.CreateDate
            });

            return(query);
        }