private DayOfWeek FindFirstTrainingDay(string userId)
        {
            var query = from spec in appContext.TrainingPlanSpecs
                        join head in appContext.TrainingPlanHeads on spec.HeadId equals head.Id
                        where head.UserId.Equals(userId)
                        orderby head.TrainingDays
                        select new { head.TrainingDays, head.UserId, spec.Id };
            var result = query.FirstOrDefault()?.TrainingDays;

            return(result == null ? DayOfWeek.Monday : trainigDayConverter.ByteToDays(result.Value).FirstOrDefault());
        }
        public IActionResult AddExFromTrainPlan(int headId)
        {
            if (headId != 0)
            {
                var userId       = userManager.GetUserId(HttpContext.User);
                var trainingDays = dayConverter.ByteToDays(appContext.TrainingPlanHeads.Where(x => x.UserId.Equals(userId)).Select(x => x.TrainingDays).ToList());

                var model = new AddExercisesFromPlanViewModel
                {
                    TrainingDays = trainingDays,
                    HeadId       = headId,
                };
                return(View(model));
            }
            return(RedirectToAction("Index", "Home"));
        }