public IHttpActionResult DelProblemCollect(DelProblemCollectDto delProblemCollectDto) { var model = _problemCollectService.IsProblemCollect(delProblemCollectDto.UserInfoId, delProblemCollectDto.ProblemId); if (model != null) { _problemCollectService.Delete(model); return(Json(new { Success = true, Msg = "OK", Data = "" })); } else { return(Json(new { Success = false, Msg = "您还没有收藏此题目", Data = "" })); } }
public JsonResult Delete(int id = 0) { try { var entity = _ProblemCollectService.GetById(id); if (entity == null) { return(Json(new { Status = Successed.Empty }, JsonRequestBehavior.AllowGet)); } _ProblemCollectService.Delete(entity); return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } }