public void NewSport(SportDetailsModel sport) { var sportModel = new Sport() { Name = sport.Name, TrainerId = sport.TrainerId, StartDate = sport.StartDate, EndDate = sport.EndDate }; this.db.Sports.Add(sportModel); this.db.SaveChanges(); }
public SportDetailsModel GetTrainers() { SportDetailsModel model = new SportDetailsModel() { Trainers = this.db.Users .Where(c => c.IsTrainer == true) .Select(s => new TrainersModel() { TrainerId = s.Id, FirstName = s.FirstName, LastName = s.LastName }) }; return(model); }