コード例 #1
0
        public void CreateOfficeDepartment(DepartmentToUser departmentToUser)
        {
            using (MySqlConnection db = new MySqlConnection(ConfigurationValues.GroveHillConnection))
            {
                departmentToUser.UniqueID = Guid.NewGuid().ToString();

                try
                {
                    const string query = "insert into officenames(UniqueID,Name,Department)"
                        + " values(@UniqueID,@Name,@Department)";
                    int rowsAffectd = db.Execute(query, new
                    {
                        @UniqueID = departmentToUser.UniqueID,
                        @Name = departmentToUser.Name,
                        @Department = departmentToUser.Department
                    });
                    int r = 5;
                }
                catch (Exception er)
                {
                    string s1 = er.ToString();
                    //Log.LogMessage(er.ToString());
                }
            }
        }
 // GET: api/AddDepartmentTo
 public IEnumerable<string> Get(DepartmentToUser departmentToUser)
 {
     return new string[] { "value1", "value2" };
 }