Esempio n. 1
0
 public ActionResult Create(Flower flower)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.AddToFlowers(flower);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(String.Empty, ex);
     }
     return View(flower);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Flowers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFlowers(Flower flower)
 {
     base.AddObject("Flowers", flower);
 }
 /// <summary>
 /// Create a new Flower object.
 /// </summary>
 /// <param name="flowerId">Initial value of the FlowerId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="article">Initial value of the Article property.</param>
 public static Flower CreateFlower(global::System.Int32 flowerId, global::System.String name, global::System.Decimal price, global::System.String article)
 {
     Flower flower = new Flower();
     flower.FlowerId = flowerId;
     flower.Name = name;
     flower.Price = price;
     flower.Article = article;
     return flower;
 }
Esempio n. 4
0
 public ActionResult Create()
 {
     Flower flower = new Flower();
     return View(flower);
 }