public ActionResult Crear(FormCollection collection)
        {
            try
            {
                var model = new Ingrediente();
                TryUpdateModel(model, new string[]
                    {
                        "Cantidad", "ProductoProductoId",
                        "UnidadUnidadId", "InventarioInventarioId"
                    }, collection.ToValueProvider());

                repository.AddIngrediente( model );
                return RedirectToAction("Lista", new { id = Int32.Parse(collection["ProductoProductoId"]) } );
            }
            catch
            {
                return View();
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Ingredientes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToIngredientes(Ingrediente ingrediente)
 {
     base.AddObject("Ingredientes", ingrediente);
 }
 /// <summary>
 /// Create a new Ingrediente object.
 /// </summary>
 /// <param name="ingredienteId">Initial value of the IngredienteId property.</param>
 /// <param name="cantidad">Initial value of the Cantidad property.</param>
 /// <param name="productoProductoId">Initial value of the ProductoProductoId property.</param>
 /// <param name="inventarioInventarioId">Initial value of the InventarioInventarioId property.</param>
 /// <param name="unidadUnidadId">Initial value of the UnidadUnidadId property.</param>
 public static Ingrediente CreateIngrediente(global::System.Int32 ingredienteId, global::System.Int32 cantidad, global::System.Int32 productoProductoId, global::System.Int32 inventarioInventarioId, global::System.Int32 unidadUnidadId)
 {
     Ingrediente ingrediente = new Ingrediente();
     ingrediente.IngredienteId = ingredienteId;
     ingrediente.Cantidad = cantidad;
     ingrediente.ProductoProductoId = productoProductoId;
     ingrediente.InventarioInventarioId = inventarioInventarioId;
     ingrediente.UnidadUnidadId = unidadUnidadId;
     return ingrediente;
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="model"></param>
 public void AddIngrediente(Ingrediente model)
 {
     entity.AddToIngredientes(model);
     SaveDB();
 }