コード例 #1
0
        public HttpResponseMessage SetEmployee(dynamic obj)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            var employee = JsonConvert.DeserializeObject(JsonObjectConverter.ObjectToJson(obj)) as JObject;

            try
            {
                string department = employee.GetValue("dept_name").ToString();
                string clinic     = employee.GetValue("clinic_name").ToString();
                string post       = employee.GetValue("post").ToString();
                string salary     = obj.salary.Value;
                string id         = employee.GetValue("id").ToString();
                ManagementHelper.SetEmployee(id, department, clinic, post, double.Parse(salary));
            }
            catch (Exception e)
            {
                response.Content    = new StringContent(e.Message);
                response.StatusCode = HttpStatusCode.BadRequest;
            }
            // 增加人员 删除人员
            return(response);
        }