Beispiel #1
0
        public APIResult SetIsDelete([FromBody] DelCommentArgsModel args)
        {
            var memberId = GetMemberId();
            var model    = db.Query <ShopComment>()
                           .Where(m => !m.IsDel)
                           .Where(m => m.MemberId == memberId)
                           .Where(m => m.Id == args.Id)
                           .FirstOrDefault();

            if (model == null)
            {
                throw new Exception("指定评论不存在");
            }

            model.IsDel = true;
            db.SaveChanges();
            return(Success(model));
        }
Beispiel #2
0
        public APIResult SetIsDelete([FromBody] DelCommentArgsModel args)
        {
            var memberId = GetMemberId();
            var model    = db.Query <ShopComment>()
                           .Where(m => !m.IsDel)
                           //.Where(m => m.MemberId == memberId)
                           .Where(m => m.Id == args.Id)
                           .FirstOrDefault();

            if (model == null)
            {
                throw new Exception("指定评论不存在");
            }
            if (!model.ShopId.HasValue)
            {
                throw new ArgumentNullException("ShopId");
            }
            CheckShopActor(model.ShopId.Value, ShopActorType.超级管理员);

            model.IsDel = true;
            db.SaveChanges();
            return(Success(model));
        }