public SwimStyle Add(SwimStyle swimStyle)
        {
            SwimStyle newSwimStyle = new SwimStyle
            {
                StyleName = swimStyle.StyleName,
            };

            _context.SwimStyles.Add(newSwimStyle);
            _context.SaveChanges();
            return(newSwimStyle);
        }
        public Coach Add(Coach coach)
        {
            Coach newCoach = new Coach
            {
                FirstName      = coach.FirstName,
                LastName       = coach.LastName,
                WorkExperience = coach.WorkExperience,
            };

            _context.Coaches.Add(newCoach);
            _context.SaveChanges();
            return(newCoach);
        }
Example #3
0
        public Swimmer Add(Swimmer swimmer)
        {
            Swimmer newSwimmer = new Swimmer
            {
                FirstName = swimmer.FirstName,
                LastName  = swimmer.LastName,
                Age       = swimmer.Age,
                CoachId   = swimmer.CoachId
            };

            _context.Swimmers.Add(newSwimmer);
            _context.SaveChanges();
            return(newSwimmer);
        }
        public Training Add(Training training)
        {
            Training newTraining = new Training
            {
                SwimmerId    = training.SwimmerId,
                SwimStyleId  = training.SwimStyleId,
                TrainingDate = training.TrainingDate,
                Distance     = training.Distance
            };

            _context.Trainings.Add(newTraining);
            _context.SaveChanges();
            return(newTraining);
        }