Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public EvaluateEntity GetEvaluate(string id)
 {
     return(service.GetEvaluate(id));
 }