コード例 #1
0
        public async Task <MessageModel <bool> > Put([FromBody] WrongBook WrongBook)
        {
            if (WrongBook == null || !(WrongBook.Id > 0))
            {
                return(new MessageModel <bool>()
                {
                    msg = "参数异常",
                    response = false
                });
            }

            var isSuc = await _wrongBookRepository.Update(WrongBook);

            return(new MessageModel <bool>()
            {
                msg = isSuc ? "更新成功" : "更新失败",
                success = isSuc,
                response = isSuc
            });
        }
コード例 #2
0
        public async Task <MessageModel <int> > Post([FromBody] WrongBook WrongBook)
        {
            if (WrongBook == null)
            {
                return(new MessageModel <int>()
                {
                    msg = "参数异常",
                    response = 0
                });
            }


            var blogId = await _wrongBookRepository.Add(WrongBook);


            return(new MessageModel <int>()
            {
                msg = "添加成功",
                success = true,
                response = blogId
            });
        }