public ApiResult Delete(string sourceId, string id) { Argument.ThrowIfNullOrEmpty(id, "Id不能为空"); var result = new ApiResult(); var evaluateId = id.ToGuid(); if (evaluateId.Equals(Guid.Empty)) { throw new WebApiInnerException("0001", "评论id格式不正确"); } var evaluate = _evaluateService.GetEvaluate(evaluateId); if (evaluate != null && evaluate.MemberId.Equals(AuthorizedUser.Id, StringComparison.OrdinalIgnoreCase)) { _evaluateService.DeleteEvaluate(evaluateId); } else { throw new WebApiInnerException("0002", "只可以删除自己的评论"); } return(result); }
public ActionResult Delete(string evaluateId) { var result = new DataJsonResult(); _evaluateService.DeleteEvaluate(evaluateId.ToGuid()); return(Json(result)); }