コード例 #1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await _receipt.DeleteReceipt(id);

            await _receipt.SaveReceipt();

            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: daxcee/Ledger
 public ActionResult DeleteReceipt(Guid id, string callback)
 {
     if (id == Guid.Empty)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "No id specified"));
     }
     try
     {
         _receiptRepository.DeleteReceipt(id);
         return(Jsonp("Success", callback, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message));
     }
 }
コード例 #3
0
        public async Task <ActionResult> DeleteReceipt(int id)
        {
            await _receipt.DeleteReceipt(id);

            return(Ok(await _receipt.SaveReceipt()));
        }