public ActionResult AgregarProducto(addProductViewModel modelo) { try { if (ModelState.IsValid) { using (Clase6Entities db = new Clase6Entities()) { var producto = new Producto(); producto.nombre = modelo.nombre; producto.precio = modelo.precio; producto.categoria = modelo.categoria; db.Producto.Add(producto); db.SaveChanges(); } return(Redirect("~/getProduct/getProductos")); } return(View(modelo)); } catch (Exception ex) { throw new Exception(ex.Message); } }