我正在尝试为用户实现基本的删除操作方法:
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?
我该怎么做呢?