public IActionResult EditMeasurements(TraineeDetailsPageViewModel model)
        {
            model.EditMeasureDate = DateTime.ParseExact(model.StrEditMeasureDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            TraineeMeasurements measurements = new TraineeMeasurements
            {
                FatRatio      = model.EditFatRatio,
                Weight        = model.EditWeight,
                Height        = model.EditHeight,
                MeasurementId = model.MeasurementId,
                Date          = model.EditMeasureDate
            };

            _traineeMeasurementsRepository.UpdateTraineeMeasurements(measurements);
            return(RedirectToAction("TraineeDetails", "Home", new { Id = model.Id }));
        }
        public IActionResult TraineeDetails(string Id)
        {
            TraineeInfoModel            personalInfo = _traineeRepository.GetTraineeById(Id);
            IEnumerable <DailyProgress> dp           = _dailyProgressRepository.DailyProgresses(Id);
            List <DailyProgress>        dpList       = new List <DailyProgress>();

            foreach (DailyProgress prog in dp)
            {
                DailyProgress progress = new DailyProgress();
                progress.AssignedSets  = prog.AssignedSets;
                progress.CompletedSets = prog.CompletedSets;
                progress.Date          = prog.Date;
                progress.ProgressId    = prog.ProgressId;
                progress.TraineeId     = prog.TraineeId;
                progress.ExerciseId    = prog.ExerciseId;
                dpList.Add(progress);
            }
            //var dailyProgressesJson = JsonConvert.SerializeObject(dpList, Formatting.None,
            //            new JsonSerializerSettings()
            //            {
            //                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            //            });
            TraineeDetailsPageViewModel model = new TraineeDetailsPageViewModel
            {
                Id                = personalInfo.TraineeId,
                Name              = personalInfo.Name,
                Surname           = personalInfo.Surname,
                Email             = personalInfo.Email,
                DateOfBirth       = (DateTime)personalInfo.Birthday,
                Image             = personalInfo.Image,
                Phone             = personalInfo.PhoneNumber,
                Weight            = (personalInfo.Weight != null ? (double)personalInfo.Weight : double.NaN),
                Height            = (personalInfo.Height != null ? (double)personalInfo.Height : double.NaN),
                FatRatio          = personalInfo.FatRatio,
                City              = personalInfo.City,
                Gender            = personalInfo.Gender,
                EntryDate         = personalInfo.EntryDate,
                DailyProgresses   = dp,
                DailyProgressList = dpList,
                DailyRoutines     = _dailyRoutineRepository.DailyRoutines(Id),
                Exercises         = _exerciseRepository.Exercises,
                Measurements      = _traineeMeasurementsRepository.GetTraineeMeasurements(Id)
            };

            return(View(model));
        }
        public IActionResult AssignExercise(TraineeDetailsPageViewModel model)
        {
            model.ExStartDate = DateTime.ParseExact(model.StrExStartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            model.ExEndDate   = DateTime.ParseExact(model.StrExEndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DailyRoutine dailyRoutine = new DailyRoutine
            {
                ExerciseId = model.ExId,
                TraineeId  = model.Id,
                StartDate  = model.ExStartDate,
                EndDate    = model.ExEndDate,
                Interval   = model.ExInterval,
                Sets       = model.ExSets
            };

            dailyRoutine.RoutineId = _dailyRoutineRepository.CreateDailyRoutine(dailyRoutine);
            _dailyProgressRepository.CreateDailyProgress(dailyRoutine);
            return(RedirectToAction("TraineeDetails", "Home", new { Id = model.Id }));
        }