示例#1
0
        public ActionResult Create(Dinner dinner)
        {
            if (ModelState.IsValid)
            {
                db.Dinners.AddObject(dinner);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(dinner);
        }
示例#2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Dinners EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDinners(Dinner dinner)
 {
     base.AddObject("Dinners", dinner);
 }
示例#3
0
 /// <summary>
 /// Create a new Dinner object.
 /// </summary>
 /// <param name="dinnerID">Initial value of the DinnerID property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="eventDate">Initial value of the EventDate property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="hostedBy">Initial value of the HostedBy property.</param>
 /// <param name="contactPhone">Initial value of the ContactPhone property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 /// <param name="country">Initial value of the Country property.</param>
 /// <param name="latitude">Initial value of the Latitude property.</param>
 /// <param name="longitude">Initial value of the Longitude property.</param>
 public static Dinner CreateDinner(global::System.Int32 dinnerID, global::System.String title, global::System.DateTime eventDate, global::System.String description, global::System.String hostedBy, global::System.String contactPhone, global::System.String address, global::System.String country, global::System.Double latitude, global::System.Double longitude)
 {
     Dinner dinner = new Dinner();
     dinner.DinnerID = dinnerID;
     dinner.Title = title;
     dinner.EventDate = eventDate;
     dinner.Description = description;
     dinner.HostedBy = hostedBy;
     dinner.ContactPhone = contactPhone;
     dinner.Address = address;
     dinner.Country = country;
     dinner.Latitude = latitude;
     dinner.Longitude = longitude;
     return dinner;
 }
示例#4
0
 public ActionResult Edit(Dinner dinner)
 {
     if (ModelState.IsValid)
     {
         db.Dinners.Attach(dinner);
         db.ObjectStateManager.ChangeObjectState(dinner, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(dinner);
 }