public Hashtable Put(int id, string name, DateTime birthday, int work_id)
        {
            int        admin = UserInfo.GetUserIdFromCookie(HttpContext.Current);
            Hashtable  ht    = new Hashtable();
            PersonInfo ai    = new PersonInfo();
            Hashtable  data  = new Hashtable();

            try
            {
                // ht.Add("state", ai.AddOne(id, name, birthday, admin, work));
                if (ai.ChangeInfo(id, 0, name, birthday, work_id))
                {
                    ht.Add("code", 20000);
                    data.Add("id", id);
                }
                else
                {
                    ht.Add("code", 40000);
                    data.Add("message", "error");
                }
            }
            catch (Exception e)
            {
                ht.Add("code", 40000);
                data.Add("message", e.Message);
            }
            ht.Add("data", data);
            return(ht);
        }
Esempio n. 2
0
        // POST api/<controller>
        public Hashtable Post([FromBody] int id_crim, [FromBody] int group, [FromBody] string name, [FromBody] DateTime birthday, [FromBody] int work)
        {
            Hashtable  ht = new Hashtable();
            PersonInfo ai = new PersonInfo();

            try
            {
                ht.Add("state", ai.ChangeInfo(id_crim, group, name, birthday, work));
            }
            catch (Exception e)
            {
                ht.Add("state", false);
                ht.Add("reason", e.Message);
            }
            return(ht);
        }