コード例 #1
0
ファイル: BannerController.cs プロジェクト: war-man/Cfood
        public ActionResult OnDelete(int id)
        {
            var result = BannerService.Delete(id);

            SetFlashMessage(result == Result.Ok ?
                            "Xóa banner thành công." :
                            "Banner không tồn tại trên hệ thống.");
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage result = null;

            try
            {
                bannerService.Delete(id);
                result = Request.CreateResponse(HttpStatusCode.OK, "Entry was deleted.");
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message, ex);
                result = Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message);
            }

            return(result);
        }