예제 #1
0
        public async Task <MessageModel <string> > Post([FromBody] d_camera d_camera)
        {
            var data = new MessageModel <string>();

            var id = (await _d_cameraServices.Add(d_camera));

            data.success = id > 0;
            if (data.success)
            {
                data.response = id.ObjToString();
                data.msg      = "添加成功";
            }

            return(data);
        }
예제 #2
0
        public async Task <MessageModel <string> > Update([FromBody] d_camera d_camera)
        {
            var data = new MessageModel <string>();

            if (d_camera != null && d_camera.ID > 0)
            {
                var id = (await _d_cameraServices.Update(d_camera));
                data.success = id;
                if (data.success)
                {
                    data.response = "id为" + d_camera.ID.ToString() + "的数据更新成功";
                    data.msg      = "更新成功";
                }
                else
                {
                    data.response = "id为" + d_camera.ID.ToString() + "的数据不存在";
                }
            }

            return(data);
        }