public JsonResult AddScene([System.Web.Http.FromBody] iot_scene model) { iot_scene scene = new iot_scene { Name = model.Name, GateWayId = model.GateWayId, ActionType = util.SetActionType(model.GateWayId), CreateTime = new DateTime(), EditTime = null }; db.iot_scene.Add(scene); var taskinfo = new { status = StatusCode.SUCCESS, message = "添加成功" }; int uprows = db.SaveChanges(); if (uprows < 1) { taskinfo = new { status = StatusCode.FAIL, message = "添加失败" }; } return(Json(taskinfo, JsonRequestBehavior.AllowGet)); }