Exemplo n.º 1
0
 public ActionResult Create(Sensor flower)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.AddToFlowers(flower);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(String.Empty, ex);
     }
     return View(flower);
 }
Exemplo n.º 2
0
 /// <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(Sensor sensor)
 {
     base.AddObject("Flowers", sensor);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new Sensor object.
 /// </summary>
 /// <param name="sensorId">Initial value of the SensorId 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 Sensor CreateSensor(global::System.Int32 sensorId, global::System.String name, global::System.Decimal price, global::System.String article)
 {
     Sensor sensor = new Sensor();
     sensor.SensorId = sensorId;
     sensor.Name = name;
     sensor.Price = price;
     sensor.Article = article;
     return sensor;
 }
Exemplo n.º 4
0
 public ActionResult Create()
 {
     Sensor flower = new Sensor();
     return View(flower);
 }