Good day mates I have this code of the contrlador and the view in asp.net mvc but when clicking on edit I get this error and verify to have created the view, I think it does not identify by id but in my code in the controller what I put it to go by id.
HTTP Error 404.0 Not Found The resource you are looking for has been removed, the name has been changed or is not available at this time
Requested URL: localhost: xxx / test / edit / 3
code in the controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using proyecto.Models;
namespace proyecto.Controllers
{
public class testController : Controller
{
private TestStatusyEntities db = new TestStatusyEntities();
// GET: test
public ActionResult Index()
{
return View(db.testmostrar().ToList());
}
// GET: test/Details/5
public ActionResult Details(double id)
{
return View();
}
// GET: test/Create
public ActionResult Create()
{
return View();
}
// POST: test/Create
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index");
}
catch
{
return View();
}
}
public Action Result Edit(double id)
{
prueba usr = db.selectid(id).First();
return View(usr);
}
[HttpPost]
public Action Result Edit(double id, FormCollection collection)
{
try
{
prueba usr = db.selectid(id).First();
if(ModelState.IsValid)
{
db.spactualizar(id, collection["encargado"],collection["estado"],collection["material"]);
}
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Vista
@model proyecto.Models.prueba
@{
ViewBag.Title ="Edit";
}
<h2>Edit</h2>
@using (Html.BeginForm())
{
<fieldset>
<div class="editor-label">
@Html.LabelFor(model => model.encargado)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.encargado)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.estado)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.estado)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.material)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.material)
</div>
<p>
<input type="submit" value="guardar"/>
</p>
</fieldset>
}
<div>
@Html.ActionLink("regresar", "Index")
</div>