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 }); } catch (Exception er) { EmployeeDesktop.API.Exceptions.ExceptionHandling.InsertErrorMessage(er.ToString()); EmployeeDesktop.API.Exceptions.ExceptionHandling.SendErrorEmail(er.ToString(), ConfigurationValues.EmailFromFriendly, ConfigurationValues.EmailSendToFriendly, ConfigurationValues.EmailSubject); } } }
// GET: api/AddDepartmentTo public IEnumerable<string> Get(DepartmentToUser departmentToUser) { return new string[] { "value1", "value2" }; }