I have this code in my controller and my stored procedures are already mapped. I access the database through Entity framework
and the edmx
is defined. I would like to know what the code is like to send (use) my stored procedure to create a new record.
public class pruebacontroller:controller
private pruebaxEntities db=new pruebaxEntities();
public Action Result Index()
{
return View(db.spmotrartabla().ToList());//Me muestra la tabla a través de un procedimiento almacenado y ya cree su vista
}
//Quiero saber que código va en esta parte para mandar llamar el procedimiento almacenado para crear
public Action Result Create()
{
return View();
}
[httpPost]
public ActionResult Create (FormCollection collection)
try
{
return RedirectToAction("Index")
}
catch
{
return View();
}