public HttpResponseMessage Delete(long id) { HttpResponseMessage response = null; try { bool isSuccess = false; isSuccess = examService.DeleteExamById(id); if (isSuccess) { response = Request.CreateResponse(HttpStatusCode.OK, "Entity removed successfully."); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public JsonResult DeleteExam(int examId) { string messageOfDeleteOperation = null; if (User.Identity.Name != null) { if (messageOfDeleteOperation != "failed") { messageOfDeleteOperation = _examService.DeleteExamById(examId); return(Json(new { messageOfDeleteOperation = messageOfDeleteOperation })); } else { messageOfDeleteOperation = "Bir Hata Oluştu !"; return(Json(new { messageOfDeleteOperation = messageOfDeleteOperation })); } } messageOfDeleteOperation = "Kullanıcı Giriş Yapmamış !"; return(Json(new { messageOfDeleteOperation = messageOfDeleteOperation })); }