ユーザーがレコードを削除した後、戻る矢印を押して、POST要求を再送信するとします。削除アクションのユーザー再送信を処理する適切な方法はありますか?
このシナリオを処理する際の選択肢は何ですか?
推奨されるのは?
[HttpPost]
public ActionResult Delete(string EntryName, Guid id, FormCollection collection)
{
try
{
var ret = from m in _entities.MyList
where m.MyListID == id
&& m.EntryName == EntryName
select m ;
if (ret.Count() == 0)
{
// This happens if the user pressed the back button and resubmitted
// todo: ask SO what is the best way to approach this...
// User feedback? How?
return RedirectToAction("Index", new { id = id });
}
_entities.DeleteObject(ret.FirstOrDefault());
_entities.SaveChanges();
return RedirectToAction("Index", new { id = id });
}
catch
{
return View();
}
}
:-)あそこニースTODOコメントは彼に彼が存在しません削除しようとするもの/既に削除されたという通知を表示します。 :) –
どのようにそのUIはMVCで行われるのだろうか? – LamonteCristo