public ActionResult Crear(FormCollection collection) { try { var model = new Especial(); TryUpdateModel(model, new string[] { "Nombre", "Descripcion", "FechaInicio", "FechaTermino", "Precio", "ProductoProductoId" }, collection.ToValueProvider() ); repository.AddEspecial(model); return RedirectToAction("Index"); } catch { return View(); } }
/// <summary> /// Create a new Especial object. /// </summary> /// <param name="especialId">Initial value of the EspecialId property.</param> /// <param name="nombre">Initial value of the Nombre property.</param> /// <param name="descripcion">Initial value of the Descripcion property.</param> /// <param name="fechaInicio">Initial value of the FechaInicio property.</param> /// <param name="fechaTermino">Initial value of the FechaTermino property.</param> /// <param name="precio">Initial value of the Precio property.</param> /// <param name="productoProductoId">Initial value of the ProductoProductoId property.</param> public static Especial CreateEspecial(global::System.Int32 especialId, global::System.String nombre, global::System.String descripcion, global::System.DateTime fechaInicio, global::System.DateTime fechaTermino, global::System.Double precio, global::System.Int32 productoProductoId) { Especial especial = new Especial(); especial.EspecialId = especialId; especial.Nombre = nombre; especial.Descripcion = descripcion; especial.FechaInicio = fechaInicio; especial.FechaTermino = fechaTermino; especial.Precio = precio; especial.ProductoProductoId = productoProductoId; return especial; }
/// <summary> /// Deprecated Method for adding a new object to the Especiales EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEspeciales(Especial especial) { base.AddObject("Especiales", especial); }
internal void AddEspecial(Especial model) { entity.AddToEspeciales(model); entity.SaveChanges(); }