public HttpResponseMessage SetDutyTime(dynamic obj) { HttpResponseMessage response = new HttpResponseMessage(); var employee = JsonConvert.DeserializeObject(JsonObjectConverter.ObjectToJson(obj)) as JObject; string emp_id = employee.GetValue("employee_id").ToString(); string room_num = employee.GetValue("clinic_num").ToString(); string Monday = employee.GetValue("Monday").ToString(); string Tuesday = employee.GetValue("Tuesday").ToString(); string Wednesday = employee.GetValue("Wednesday").ToString(); string Thursday = employee.GetValue("Thursday").ToString(); string Friday = employee.GetValue("Friday").ToString(); string Saturday = employee.GetValue("Saturday").ToString(); string Sunday = employee.GetValue("Sunday").ToString(); Duty item = new Duty(room_num, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); // 插入数据 try { ManagementHelper.SetDuty(item, emp_id); } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.BadRequest; } // duty表生成id // 设置room_num // max_limit设置成随机数 // 日期随便设置了 上下午。。。 return(response); }