public HttpResponseMessage Delete(int ID)
        {
            var    student       = stuDB.ListAll().Find(t => t.Id.Equals(ID));
            string message       = "Student Deleted Successfully";
            string messagenodata = "Data Not found/ Might be Deleted or Removed";
            HttpResponseMessage response;

            if (student == null)
            {
                response = Request.CreateResponse(HttpStatusCode.NoContent, messagenodata);
            }
            else
            {
                stuDB.Delete(ID);
                response = Request.CreateResponse(HttpStatusCode.OK, message);
            }
            return(response);
        }
コード例 #2
0
 public JsonResult Delete(int Id)
 {
     return(Json(db.Delete(Id), JsonRequestBehavior.AllowGet));
 }
コード例 #3
0
        /// <summary>
        /// Delete student
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult Delete(int id)
        {
            var rs = db.Delete(id);

            return(Json(new { msg = rs }, JsonRequestBehavior.AllowGet));
        }