Esempio n. 1
0
        public JsonResult RecordCalorieCountOffDay(string personId, string currentDateTime)
        {
            DateTime            localTime = DateTime.Parse(currentDateTime);
            CalorieCountHandler handler   = new CalorieCountHandler();

            handler.InsertCalorieCountOffDay(Convert.ToInt32(personId), localTime);

            return(Json("Off day recorded"));
        }
Esempio n. 2
0
        public JsonResult GetCaloriesForLastThirtyDays(string personId, string currentDateTime)
        {
            DateTime            endDate   = DateTime.Parse(currentDateTime);
            DateTime            startDate = endDate.AddDays(-30);
            CalorieCountHandler handler   = new CalorieCountHandler();

            List <XYModel> calorieAndDateModel = handler.GetCaloriesAndDatesAsXAndY(Convert.ToInt32(personId), startDate, endDate);

            return(Json(calorieAndDateModel));
        }
Esempio n. 3
0
        public JsonResult RecordCalories(string personId, string calorieValue, string currentDateTime)
        {
            DateTime            localTime = DateTime.Parse(currentDateTime);
            CalorieCountHandler handler   = new CalorieCountHandler();
            List <CalorieCount> counts    = handler.Insert(Convert.ToInt32(personId), Convert.ToInt32(calorieValue), localTime);

            int total = counts.Select(x => x.Calories).Sum();

            return(Json("Total Calories " + total));
        }