我是 ASP.NET MVC 的新手,我正在尝试开发一个简单的应用程序来实现 CRUD 操作,但是当返回到控制器时,删除操作遇到了一个奇怪的问题,因为它返回一个空对象,不允许操作来完成。我将在下面展示模型、控制器及其各自视图的代码。
模型:
public class Biblioteca
{
public int IdBiblioteca { get; set; }
public string Nome { get; set; }
public string Endereco { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
控制器
public class BibliotecaController : Controller
{
ADAO dao = DAOFactory.GetInstance(DAOFactory.DAOType.Biblioteca);
[HttpGet]
public ActionResult DeleteLibrary(int id)
{
return View(dao.Select(id));
}
[HttpPost]
public ActionResult DeleteLibrary(Biblioteca b)
{
dao.Delete(b);
return RedirectToAction("Index");
}
}
Run Code Online (Sandbox Code Playgroud)
查看删除库
@model BibliotecaWebApp.Models.Biblioteca
<h2>DeleteLibrary</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Biblioteca</h4>
<hr /> …Run Code Online (Sandbox Code Playgroud) 当我试图在MATLAB中将两组点绘制成图表时,我遇到了一些问题.我创建了两个矩阵,分别代表组,一组圆圈和另一组十字架.结果应如下图所示:
circles = [1 1; 2 1; 2 2; 2 3; 2 4; 3 2; 3 3; 4 1; 4 2; 4 3];
crosses = [1 2; 1 3; 1 4; 2 5; 3 4; 3 5; 4 4; 5 1; 5 2; 5 3];
plot(circles, 'ro');
hold on
plot(crosses, 'b+');
hold off;
axis([0,6,0,6]);
Run Code Online (Sandbox Code Playgroud)
但是这段代码绘制了一张凌乱的图表,类似于下图:
情节可能有什么问题?