public ActionResult Subscribe(FormCollection form) { using (var context = new ModelContainer()) { var subscriber = new Subscriber(); TryUpdateModel(subscriber, new[] { "Name", "Email" }); context.AddToSubscriber(subscriber); context.SaveChanges(); } return RedirectToAction("ThankYou"); }
/// <summary> /// Deprecated Method for adding a new object to the Subscriber EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSubscriber(Subscriber subscriber) { base.AddObject("Subscriber", subscriber); }
/// <summary> /// Create a new Subscriber object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="email">Initial value of the Email property.</param> public static Subscriber CreateSubscriber(global::System.Int32 id, global::System.String name, global::System.String email) { Subscriber subscriber = new Subscriber(); subscriber.Id = id; subscriber.Name = name; subscriber.Email = email; return subscriber; }