我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 ();' –