예제 #1
0
        public object Post(JObject data)
        {
            string _id = data.Value <string>("_id");
            var    org = data.ToObject <sys_organize>();

            using (var db = new SysContext())
            {
                if (string.IsNullOrEmpty(_id))
                {
                    db.sys_organize.Add(org);
                }
                else
                {
                    var organize = db.sys_organize.Find(_id);
                    DynamicData.Copy(org, organize, data);
                }
                db.SaveChanges();
            }
            return(true);
        }