/// <summary> /// Create a new Event object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="date">Initial value of the Date property.</param> /// <param name="locationId">Initial value of the LocationId property.</param> /// <param name="eventTypeId">Initial value of the EventTypeId property.</param> /// <param name="createdAt">Initial value of the CreatedAt property.</param> public static Event CreateEvent(global::System.Int64 id, global::System.String name, global::System.DateTime date, global::System.Int64 locationId, global::System.Int64 eventTypeId, global::System.DateTime createdAt) { Event @event = new Event(); @event.Id = id; @event.Name = name; @event.Date = date; @event.LocationId = locationId; @event.EventTypeId = eventTypeId; @event.CreatedAt = createdAt; return @event; }
public static EventVM FromDataObject(Event evt) { EventVM retval = null; if (evt != null) { retval = new EventVM { CreatedAt = evt.CreatedAt, Date = evt.Date, EventType = EventTypeVM.FromDataObject(evt.EventType), EventTypeId = evt.EventTypeId, FilmwebId = evt.FilmwebId, Id = evt.Id, IMDBId = evt.IMDBId, LastUpdated = evt.LastUpdated, LocationId = evt.LocationId, Location = LocationVM.FromDataObject(evt.Location), Name = evt.Name, }; List<MemberEventScore> memEvtsScores = evt.MemberEventScores.ToList(); if (memEvtsScores != null && memEvtsScores.Count > 0) { retval.MemberEventScores = (from mes in memEvtsScores select MemberEventScoreVM.FromMemberEventScore(mes)).ToList(); } } if (retval.MemberEventScores != null && retval.MemberEventScores.Count > 0) { int sum = retval.MemberEventScores.Sum(mes => mes.Score); retval.Score = (float)sum / (float)retval.MemberEventScores.Count; } return retval; }
/// <summary> /// Deprecated Method for adding a new object to the Events EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEvents(Event @event) { base.AddObject("Events", @event); }