Beispiel #1
0
        public IActionResult SaveMeasurements(BodyMeasurmentsVM bodyMeasurments)
        {
            var userID = userManager.GetUserId(HttpContext.User);

            bodyMeasurments.Date = DateTime.Parse(bodyMeasurments.Date.ToShortDateString());
            dataManager.AddWeight(userID, bodyMeasurments);

            return(Content("Weight saved successfully"));
        }
        //private List<string> GetFavoritesForMain(string userID)
        //{
        //    return UserFavorites.Where(c => c.UserId == userID).OrderBy(o => o.Id).Select(f => f.Favorite).ToList();
        //}

        //internal void AddUserFavorite(string userID, string favoriteToAdd)
        //{
        //    UserFavorites.Add(new UserFavorites() { UserId = userID, Favorite = favoriteToAdd });
        //    SaveChanges();
        //}

        //private List<GoalVM> GetGoalsForMain(string userID)
        //{
        //    //return Goal.Where(u => u.UserId == userID);
        //    return null;
        //}

        internal void AddWeightMeasurment(string userID, BodyMeasurmentsVM bodyMeasurments)
        {
            UserWeight.Add(new UserWeight()
            {
                Date        = bodyMeasurments.Date,
                UserId      = userID,
                UserWeight1 = bodyMeasurments.BodyWeight
            });
            SaveChanges();
        }
Beispiel #3
0
 public void AddWeight(string userID, BodyMeasurmentsVM bodyMeasurments)
 {
     workoutcontext.AddWeightMeasurment(userID, bodyMeasurments);
 }