/// <summary> /// Create a new Event object. /// </summary> /// <param name="eventId">Initial value of the EventId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="created">Initial value of the Created property.</param> /// <param name="creator">Initial value of the Creator property.</param> /// <param name="availableSpots">Initial value of the AvailableSpots property.</param> /// <param name="deadLine">Initial value of the DeadLine property.</param> /// <param name="categoryId">Initial value of the CategoryId property.</param> /// <param name="startTime">Initial value of the StartTime property.</param> /// <param name="isAutomaticDrawing">Initial value of the IsAutomaticDrawing property.</param> public static Event CreateEvent(global::System.Int32 eventId, global::System.String name, global::System.DateTime created, global::System.String creator, global::System.Int32 availableSpots, global::System.DateTime deadLine, global::System.Int32 categoryId, global::System.DateTime startTime, global::System.Boolean isAutomaticDrawing) { Event @event = new Event(); @event.EventId = eventId; @event.Name = name; @event.Created = created; @event.Creator = creator; @event.AvailableSpots = availableSpots; @event.DeadLine = deadLine; @event.CategoryId = categoryId; @event.StartTime = startTime; @event.IsAutomaticDrawing = isAutomaticDrawing; return @event; }
private static void SaveEvents(int num, string name) { var time = DateTime.Now.AddSeconds(num + 1); var categoryId = GetRandomCategoryId(); var newEvent = new Event { Name = name, CategoryId = categoryId, Description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam", AvailableSpots = random.Next(1, 10), InformationUrl = "Lorem ipsum is fun", StartTime = time, DeadLine = time, IsAutomaticDrawing = true, Created = DateTime.Now, Creator = repository.Users.FirstOrDefault().Email }; repository.AddToEvents(newEvent); }
/// <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); }