public ActionResult Crear(FormCollection collection) { try { // TODO: Add insert logic here repository.AddInventory(collection["Nombre"].ToString(), Convert.ToInt32(collection["CantidadTotal"].ToString()), Convert.ToInt32(collection["Unidad.Nombre"].ToString())); return(RedirectToAction("Index")); } catch { return(View()); } }