我Ajax调用,我将通过价值后端删除行的数据库通过Ajax调用
我需要通过这个值来查找数据库中的数据,然后将其删除
我在写这篇文章的代码后端
public ActionResult DeletingInternal(string title)
{
var item = db.Appointments.Where(x => x.Title == title)
.Select(x => new
{
title = x.Title
}).FirstOrDefault();
db.Appointments.Remove(item);
}
但该行db.Appointments.Remove(item);
在我有错误
严重性代码说明项目文件李NE抑制状态 错误CS1503参数1:不能从转换'到 'RS_Main.Models.Appointment' RS_Main C:\用户\ nemes \来源\回购\ RIS_Project_New \ RS_Main \ \控制器28 CalendarController.cs主动
如何从数据库中删除行?
只是删除'。选择(X =>新{标题= x.Title})'位 - 'VAR项目= db.Appointments.Where(X => x.Title ==标题).FirstOrDefault ();' –