コード例 #1
0
 public ActionResult Delete(int id)
 {
     if (StudentBiz.Del(id))
     {
         return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
     }
     else
     {
         return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
     }
 }
コード例 #2
0
 public ActionResult Delete(int Sn)
 {
     if (StudentBiz.Del(Sn))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(JavaScript("alert('刪除失敗');"));
     }
 }
コード例 #3
0
        // DELETE api/default1/5
        public HttpResponseMessage Delete(int id)
        {
            var info = StudentBiz.GetInfo(id);

            if (info.Sn == 0)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            bool result = StudentBiz.Del(id);

            if (!result)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "delete error"));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, info));
        }