Пример #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SeriesClasses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSeriesClasses(SeriesClass seriesClass)
 {
     base.AddObject("SeriesClasses", seriesClass);
 }
Пример #2
0
        public SeriesViewModel UpdateSeries(SeriesViewModel model)
        {
            var series = _seriesRepository.GetSeriesById(model.SeriesId);

            series.Name = model.Name;
            series.BeginDate = model.BeginDate;

            IList<SeriesClass> newClasses = null;

            if (model.SelectedClasses != null && model.SelectedClasses.Length > 0)
            {
                //series = _seriesRepository.DeleteAllSeriesClasses(series);

                foreach (var classId in model.SelectedClasses)
                {
                    var classInSeries = new SeriesClass { SeriesId = model.SeriesId, ClassId = classId };

                    if (newClasses == null)
                    {
                        newClasses = new List<SeriesClass>();
                    }

                    newClasses.Add(classInSeries);
                }
            }

            _seriesRepository.UpdateSeries(series, newClasses);

            return model;
        }
Пример #3
0
 /// <summary>
 /// Create a new SeriesClass object.
 /// </summary>
 /// <param name="seriesClassId">Initial value of the SeriesClassId property.</param>
 /// <param name="classId">Initial value of the ClassId property.</param>
 /// <param name="seriesId">Initial value of the SeriesId property.</param>
 public static SeriesClass CreateSeriesClass(global::System.Int32 seriesClassId, global::System.Int32 classId, global::System.Int32 seriesId)
 {
     SeriesClass seriesClass = new SeriesClass();
     seriesClass.SeriesClassId = seriesClassId;
     seriesClass.ClassId = classId;
     seriesClass.SeriesId = seriesId;
     return seriesClass;
 }
Пример #4
0
        public SeriesViewModel SaveNewSeries(SeriesViewModel model)
        {
            var series = new Series
                           	{
                           		Name = model.Name,
                                BeginDate = model.BeginDate,
                           		ClubId = model.Club.ClubId,
                                DateCreated = DateTime.Now
                           	};

            if (model.SelectedClasses != null && model.SelectedClasses.Length > 0)
            {
                foreach (var classId in model.SelectedClasses)
                {
                    var classInSeries = new SeriesClass {SeriesId = model.SeriesId, ClassId = classId};

                    if (series.SeriesClasses == null)
                    {
                        series.SeriesClasses = new EntityCollection<SeriesClass>();
                    }

                    series.SeriesClasses.Add(classInSeries);
                }
            }

            _seriesRepository.SaveNewSeries(series);

            model.SeriesId = series.SeriesId;

            return model;
        }