0
我試圖實現對用戶的基本刪除操作方法:從我DATABSE背景的基礎上刪除ID的用戶
private User_Manager_Interface.Models.ApplicationDbContext userDb = new User_Manager_Interface.Models.ApplicationDbContext();
// POST: /Users/Delete/5
[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{
try
{
// TODO: Add delete logic here
//.Remove(u => u.id == id);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
我不完全知道如何刪除用戶。
這是我到目前爲止已經試過:
userDb.Users.Remove(); But now I don't know how to tell it to delete the user with a certain ID?
我該怎麼辦呢?