Ejemplo n.º 1
0
        public void AddTraining(TrainingFromListDTO training, int id)
        {
            string           login   = HttpContext.Session.GetString("User_Login");
            TrainingsService service = new TrainingsService(services);

            service.AddTraining(training, id, login);
        }
Ejemplo n.º 2
0
        public void AddTraining(TrainingFromListDTO training, int course_id, string login)
        {
            Course course = db.Courses.Get(course_id);

            if (course != null && course.Coach_Login == login)
            {
                Training new_training = new Training()
                {
                    Name          = training.Name,
                    Description   = training.Description,
                    Course_ID     = course_id,
                    Num_in_Course = course.Trainings.Count()
                };
                db.Trainings.Create(new_training);
                db.Save();
            }
        }