Inheritance: System.Data.Objects.DataClasses.EntityObject
コード例 #1
0
ファイル: DBModel.Designer.cs プロジェクト: heinek/ITimeU
 /// <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="eventDate">Initial value of the EventDate property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static Event CreateEvent(global::System.Int32 eventId, global::System.String name, global::System.DateTime eventDate, global::System.Boolean isDeleted)
 {
     Event @event = new Event();
     @event.EventId = eventId;
     @event.Name = name;
     @event.EventDate = eventDate;
     @event.IsDeleted = isDeleted;
     return @event;
 }
コード例 #2
0
ファイル: DBModel.Designer.cs プロジェクト: heinek/ITimeU
 /// <summary>
 /// Deprecated Method for adding a new object to the Events EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEvents(Event @event)
 {
     base.AddObject("Events", @event);
 }
コード例 #3
0
ファイル: EventModel.cs プロジェクト: heinek/ITimeU
 /// <summary>
 /// Saves this event.
 /// </summary>
 /// <returns></returns>
 public bool Save()
 {
     if (EventDate < DateTime.Today.Date) throw new ArgumentException("Ugyldig dato for stevne");
     using (var context = new Entities())
     {
         var newEvent = new Event();
         newEvent.Name = Name;
         newEvent.EventDate = EventDate;
         try
         {
             context.Events.AddObject(newEvent);
             context.SaveChanges();
             EventId = newEvent.EventId;
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }