コード例 #1
0
 async public Task <ActionResult> DeleteConfirmed(Guid id)
 {
     try
     {
         await repository.Delete(id);
     }
     catch (DataException)
     {
         return(RedirectToAction("DataError", "Error", new { area = "", message = "文章刪除錯誤" }));
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
 public async Task <ActionResult> DeleteConfirmed(Guid id)
 {
     try
     {
         await repository.Delete(id);
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "無法儲存,請聯絡網站管理員");
     }
     return(RedirectToAction("Index"));
 }
コード例 #3
0
 public ActionResult DeleteConfirmed(Guid id)
 {
     try
     {
         repository.Delete(id);
         db.SaveChanges();
     }
     catch (DataException)
     {
         return(RedirectToAction("DataError", "Error", new { area = "", message = "刪除錯誤" }));
     }
     return(RedirectToAction("Index"));
 }